Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71164 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59877 invoked from network); 16 Jan 2014 00:09:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jan 2014 00:09:36 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@tutteli.ch; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=php@tutteli.ch; sender-id=pass Received-SPF: pass (pb1.pair.com: domain tutteli.ch designates 80.74.154.78 as permitted sender) X-PHP-List-Original-Sender: php@tutteli.ch X-Host-Fingerprint: 80.74.154.78 ns73.kreativmedia.ch Linux 2.6 Received: from [80.74.154.78] ([80.74.154.78:49791] helo=hyperion.kreativmedia.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 93/02-48719-E3327D25 for ; Wed, 15 Jan 2014 19:09:34 -0500 Received: (qmail 23298 invoked from network); 16 Jan 2014 01:09:31 +0100 Received: from heim-032-99.raab-heim.uni-linz.ac.at (HELO RoLaptop) (193.171.32.99) by ns73.kreativmedia.ch with (AES128-SHA encrypted) SMTP; 16 Jan 2014 01:09:31 +0100 To: "'Andrea Faulds'" , "'Crypto Compress'" , References: <001301cf1227$6d082ab0$47188010$@tutteli.ch> <002d01cf1234$01e6dc60$05b49520$@tutteli.ch> <004c01cf123d$35730870$a0591950$@tutteli.ch> <52D71748.1090402@googlemail.com> <52D71FAE.8030002@ajf.me> In-Reply-To: <52D71FAE.8030002@ajf.me> Date: Thu, 16 Jan 2014 01:09:29 +0100 Message-ID: <005001cf124f$3a40df00$aec29d00$@tutteli.ch> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQGahXeLh/KZbd8XAeJ9KP0Xitay+AEcU2WhAaqmqGABFinRgAGUH60GAsS5wSoDHy62oAKq0EPNApG0KWABZZ/6V5pf1W9g Content-Language: de-ch Subject: RE: [PHP-DEV] Introducing "Array Of" RFC From: php@tutteli.ch ("Robert Stoll") > -----Original Message----- > From: Andrea Faulds [mailto:ajf@ajf.me] > Sent: Thursday, January 16, 2014 12:54 AM > To: Crypto Compress; internals@lists.php.net > Subject: Re: [PHP-DEV] Introducing "Array Of" RFC > > > > On 15/01/14 23:18, Crypto Compress wrote: > > e.g.: function foo(Bar[null] = null) > > I'd prefer the ? syntax for nullables that C# has. I'm imagining > something like this: > > function foo(Bar? $a) {} // $a is Bar/null > function foo(Bar?[] $a) {} // $a is array of Bars/nulls > function foo(Bar[]? $a) {} // $a is array of Bars, or null > function foo(Bar?[]? $a) {} // $a is array of Bars/nulls, or null > > -- > Andrea Faulds > http://ajf.me/ > > -- I like Andrea's proposal, this way we can support all scenarios. It is possible to define that NULL is a valid entry in an array and we would stick to the same decision as for actual parameters, namely that one has to define explicitly that null is a valid entry. This would make me happy and I suppose also Philip. Just as side notice, this syntax would also give the chance for PHP to get rid of the double meaning of "=null" in a later version. I am talking about the following case: function foo(Foo $a=null, $b=1){} Where one might not want to specify that $a is optional but cannot do it differently at the moment - with the additional ? it could change :)