Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58850 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93985 invoked from network); 12 Mar 2012 01:50:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Mar 2012 01:50:15 -0000 Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.170 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.161.170 mail-gx0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:43855] helo=mail-gx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 46/2B-24751-7565D5F4 for ; Sun, 11 Mar 2012 20:50:15 -0500 Received: by ggmb2 with SMTP id b2so2373379ggm.29 for ; Sun, 11 Mar 2012 18:50:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=J4oSV3GUGARIS/XxN+nrL/RM8MtjCJ5Suab5YbxMOnM=; b=q7joZAnCHfJnS1d9GljQECIWcHMYSsuwB1QGzu9tDU7YSUrMVg+frokdBCGvvcNk0d Z6zx4GIfFFxjJ1rWL+B64igXpkh4A9rSxOnaAd1Myy785x5sGFhFibQF9R3K44otyeWq ruapmTwZZWx0CTw/mrukvLaDKkebBpzBoqhComqUYPA6g79mOK8J9MsII7+/2x8RHMOO db9CBXJsVEokLyiMV4Y9XjkOb8xr6/6DdQd+jw16vXHPHQVxeCVfCJEzdqIdOXDmzom7 aNBY5jxffbp5rH9909C5AIQfJ7NSamqTc98o/VOVQ4IBVFs4dRy9u6ev4RfvuAYpmXa/ ZmFw== MIME-Version: 1.0 Received: by 10.224.32.12 with SMTP id a12mr6327395qad.66.1331517012982; Sun, 11 Mar 2012 18:50:12 -0700 (PDT) Received: by 10.229.49.74 with HTTP; Sun, 11 Mar 2012 18:50:12 -0700 (PDT) In-Reply-To: References: Date: Sun, 11 Mar 2012 21:50:12 -0400 Message-ID: To: Tjerk Meesters Cc: Lazare Inepologlou , Simon Schick , "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters From: ircmaxell@gmail.com (Anthony Ferrara) Ok, so it looks like we've had some decent conversation, but it has started to tail off a bit. I'd normally draft an RFC at this point, but it seems there's still some contention on how exactly the implementation should work. Personally, if we're going to go for any form of strict checking (meaning not blind-conversion), I will not support these hint rules diverging from zend_parse_parameters (internal functions). It just creates a new layer of inconvenience and confusion for not a whole lot of gain. When I say divergence from ZPP, I'm talking about the same behavior when ZPP returns SUCCESS, and a E_RECOVERABLE_ERROR when ZPP returns FAILURE... Now, with that said, I'd be all for making sane changes to ZPP to bring both inline with a common goal. Think that passing "1abc" to an int type hinted parameter (which currently raises a notice) is unacceptable? Then my opinion is that it should be tightened in both places at the same time. But they should stay connected as closely as possible for consistency... So, with that said, let me ask this question: What needs to change from the current POC before it can be formalized into an RFC? Do we need to tighten the conversions? Or are they OK as-is? Thoughts? Anthony On Sat, Mar 10, 2012 at 2:45 AM, Tjerk Meesters wrote: > > On 9 Mar, 2012, at 11:20 PM, Lazare Inepologlou wrote: > >> Type casting combined with passing by reference is problematic in many >> ways. Just an example: >> >> fuction foo( string & $buffer) { ... } >> foo( $my_buffer ); >> >> Here, $my_buffer has just been declared, so it is null. Should this be an >> error? I don't know! So, I think that that passing by reference should not >> be (immediately) supported. >> > > Strictly speaking, if you add a type to a referenced variable in that way it's only logical that you expect it to have a proper value when the function is called. After all, it's not an output type declaration :) >