Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58828 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70989 invoked from network); 10 Mar 2012 03:32:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Mar 2012 03:32:47 -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:52473] helo=mail-gx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E3/C3-39571-C5BCA5F4 for ; Fri, 09 Mar 2012 22:32:46 -0500 Received: by ggmb2 with SMTP id b2so1583043ggm.29 for ; Fri, 09 Mar 2012 19:32:41 -0800 (PST) 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=2ONz4WbIv1ejTQ6fOd63z073fNSi3GvG3x97cwrIpcM=; b=nZtad6Lzhg1QHSa4EP9Q0heL8PaFpRyzqf4Nt8BRA4YgAZ0AFQY3jx32LlRxOwRjBC tTcdKW4NF9mxqFFz87tDIuWdDPYhzNiWcDjT+vnSzdbYQ8syylj37w1+YkqmJWkeTg9B v+FeJUhfeNAe3qObzjkKZvIsYVWzHBpGQ/ssgSe3uYieSbC2F72VSTJODGTX1ZkWidsV FWL5wxUFbkAaE9oxrlJ3uuZSAw0ciRLqor6p6e6A5UVHYGryNDcBITWjnk8bMJihZHxr +bvOGQR8SqEzYVx3+UfiSsRyyUSUXb4G/ckp89NFwOAfQ2C+9AjCWLYkfOkWcVct15D7 /ibQ== MIME-Version: 1.0 Received: by 10.224.32.12 with SMTP id a12mr1418530qad.66.1331350361693; Fri, 09 Mar 2012 19:32:41 -0800 (PST) Received: by 10.229.49.74 with HTTP; Fri, 9 Mar 2012 19:32:41 -0800 (PST) In-Reply-To: References: Date: Fri, 9 Mar 2012 22:32:41 -0500 Message-ID: To: Lazare Inepologlou Cc: 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) Lazare, >> This won't make it easy passing a variable as reference. > > Type casting combined with passing by reference is problematic in many ways. No it's not. The core functionality does it quite fine, and it uses typed parameters... > 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. This one one where my wants are superseded by existing functionality. The current implementation has a definite answer to that. And the answer is that no, no notice is raised. Plenty of people are using it to that effect right now. Check out this abomination: http://stackoverflow.com/questions/9636052/is-there-a-way-to-pass-an-undeclared-variable-to-a-function-without-notice/9636395#9636395 However, it's also quite useful. Look at your code base. Whenever you call preg_match with the third parameter, do you *always* initialize the $match parameter? And do you *always* make sure it's an array? The chances are very likely (based on a lot of the code I've seen), no. This functionality is very pervasive to the core, and we shouldn't go changing it now (even implementing user-land pass-by-reference). Not supporting references is one thing, but changing the semantics of it is a completely different talk... Anthony