Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49300 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98894 invoked from network); 11 Aug 2010 00:29:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Aug 2010 00:29:01 -0000 Authentication-Results: pb1.pair.com header.from=phpwnd@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=phpwnd@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: phpwnd@gmail.com X-Host-Fingerprint: 209.85.210.42 mail-pz0-f42.google.com Received: from [209.85.210.42] ([209.85.210.42:58431] helo=mail-pz0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/12-20356-BCEE16C4 for ; Tue, 10 Aug 2010 20:29:00 -0400 Received: by pzk30 with SMTP id 30so4668569pzk.29 for ; Tue, 10 Aug 2010 17:28:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=4BIreVSxfN/qvLwUvDzN3jNjeGgEYD6wqnAOdVNbj2g=; b=djDlnm72WgmsexiHcJwC+8MDyuMknb4GDPSy1n96fFz45LLWHdaZ/yp+YghKa6Dao9 8W44M6hWlIoWT04LwxLyBQUv098SQ6B1R3/dh1MVTiqloNPNGHA90JcyEcUSIfuzr8WF PqxRARkZcxTDFuDLl3uXo8B2wyLOpD6TovT0M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=TOYiLIj3GGnh6ijnHva7UbOPWWEBPtTGSif/ZqRoNgWHCKSABta6YXPRChR5OWspeT vzXT1PxaVfL5VKI3kuuVqoi6AVGQX1qgNo6TvUiHMRGYSfp+vGJ43js8GxLoIKcVJf87 6gDOlAuH9rwFwqQ/6Vm0VU9OYpnURdpU9xMGk= MIME-Version: 1.0 Received: by 10.114.111.5 with SMTP id j5mr21132293wac.27.1281486536712; Tue, 10 Aug 2010 17:28:56 -0700 (PDT) Received: by 10.114.154.9 with HTTP; Tue, 10 Aug 2010 17:28:56 -0700 (PDT) In-Reply-To: <4C61E5CA.5070604@sugarcrm.com> References: <1281478269.6608.292.camel@guybrush> <4C61E5CA.5070604@sugarcrm.com> Date: Wed, 11 Aug 2010 02:28:56 +0200 Message-ID: To: Stas Malyshev Cc: Arvids Godjuks , Internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Typehints (was Re: [PHP-DEV] Annoucing PHP 5.4 Alpha 1) From: phpwnd@gmail.com (Josh Davis) On 11 August 2010 01:50, Stas Malyshev wrote: > Hi! > >> Derick's point was about consistency. The approach described in his >> mail is consistent with current syntax and mechanism(s). Current > > No it is not. There's no functions that produce errors when fed 1 instead of > boolean "true" - all internal functions convert. First of all, I am talking about the typehinting syntax and mechanism here. As Derick pointed out, current typehints are strict. Secondly, I don't support amalgaming userland with internal functions. If I was to treat those internal functions as if they were written in userland, I'd say that they don't use scalar typehints, specifically for the reason you mentionned. Internal functions just typecast whatever you throw at them, no question asked. > That's exactly how internal functions worked in PHP for 10 years - > "sometimes" (meaning when the type is wrong) typecast. That's how the rest Again, I'm not talking about internal functions but typehinting. Now, when a userland developer uses typehints it means they expect a variable of a certain type to be passed. If they want typecasting, Derick proposes a convenient way to do that. > How it's "ambiguous" The current typehinting system does not typecast. Changing that behaviour makes it ambiguous. It introduces a new behaviour grafted onto the old mechanism and without a new syntax.