Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58864 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32944 invoked from network); 12 Mar 2012 08:40:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Mar 2012 08:40:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=arvids.godjuks@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=arvids.godjuks@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.170 as permitted sender) X-PHP-List-Original-Sender: arvids.godjuks@gmail.com X-Host-Fingerprint: 209.85.212.170 mail-wi0-f170.google.com Received: from [209.85.212.170] ([209.85.212.170:60458] helo=mail-wi0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 68/72-20445-F66BD5F4 for ; Mon, 12 Mar 2012 03:40:16 -0500 Received: by wibhr17 with SMTP id hr17so2910404wib.5 for ; Mon, 12 Mar 2012 01:40:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=+vKK+Ypa+MvjpTF6Eq53Ys+CfrZFDBFWdF2btgLcC9M=; b=tnZeAHu2Qo0hhpBrYVGvpopyXbCHG3iAx55Mtpf2M7TIOzXpU13wjqVxKuo/r2FMvf Fe/n/tcVW75J1LuBVetkiOaPk8rRS+Bg9Leu7SslQ2QB0KzzZSBA6pqSjNF6RuVUBaf1 5OKm+vmtV1tcgJv1PUGrT6o9lVA02KTuFdNOugxaHGkgX5q1W5LYGAvZG4ECogoSFSrD 2+WXon69QwG8XNey2sYNp0rAq+EYikXu0OetucynrIIrvXLc2ZTqcDKHqmnfNRmYgcqh PskGruL36qiDrBJKmWOHxhuO06m0+sW8vHosX3kWuOTeR++0b2RcUlTZjPRXzzkoY8Y0 hH+Q== Received: by 10.216.138.38 with SMTP id z38mr6629401wei.63.1331541612544; Mon, 12 Mar 2012 01:40:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.156.129 with HTTP; Mon, 12 Mar 2012 01:39:52 -0700 (PDT) In-Reply-To: References: Date: Mon, 12 Mar 2012 10:39:52 +0200 Message-ID: To: Anthony Ferrara Cc: Tjerk Meesters , Lazare Inepologlou , Simon Schick , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=0016e6dd8e4bd1c19e04bb07b0e1 Subject: Re: [PHP-DEV] [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters From: arvids.godjuks@gmail.com (Arvids Godjuks) --0016e6dd8e4bd1c19e04bb07b0e1 Content-Type: text/plain; charset=UTF-8 I should point out that returning false on param parsing failure on the language level is one thing (not to mention it's not ok to do that in the first place by my taste), but forcing that behavior on the user-land level is kind'a too much. Consider how the code will become much more complicated - now you have to not only to check what you pass to the functions, but you have to check what it returns every single time (do I have to mention that false can be never returned by the function at all except when the param parsing fails?). What is consistent and exists on the internal language layer not necessarily good for the user-land. I'm kind'a surprised no one thought of that. As I said I can live with the throwing notices and warnings (and not E_RECOVERABLE_ERROR as I personally wanted), but returning false even not trying to run the function is just a bad idea all over the place. 2012/3/12 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 :) > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --0016e6dd8e4bd1c19e04bb07b0e1--