Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71171 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91848 invoked from network); 16 Jan 2014 09:18:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jan 2014 09:18:07 -0000 Authentication-Results: pb1.pair.com header.from=martin.keckeis1@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=martin.keckeis1@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.178 as permitted sender) X-PHP-List-Original-Sender: martin.keckeis1@gmail.com X-Host-Fingerprint: 209.85.214.178 mail-ob0-f178.google.com Received: from [209.85.214.178] ([209.85.214.178:60495] helo=mail-ob0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4E/20-24763-CC3A7D25 for ; Thu, 16 Jan 2014 04:18:04 -0500 Received: by mail-ob0-f178.google.com with SMTP id uz6so2490800obc.9 for ; Thu, 16 Jan 2014 01:18:01 -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=UJduJ5+e7tsgF6UA5JslJoL8ZsWunJzqZIJCV46TwKk=; b=oWNQ5SKCPGJGIAYrVOFcIfNsuM8Gt9+vVi3x5JHeXb863DaK7DalFKRBhXF+HsB6rU /SJT4wLWsm9tDVmPHQKfPO+flUVClUvSmQeovJf/pLrte24g6FnkjTNT3bQmYEsbRmo1 IEg0izB4OydOxXDhyGGpREQGVvnYGj5ANTh95wdSTuh2nI/H/9TXonSzSlhAn3/eFHUj OSxy2fV9CNSj/zEBc/X9qz5krwXweplDUOw2zrBTh8WEJqaerpW51p2TbU4PNb2EJEuB 9QVm3DOVAk/+sorhym6xHBR4OuIQ35WsARAQ4Cwab9ocLmRX1NpI5Cse9ziGn7E41zTS 0NJw== MIME-Version: 1.0 X-Received: by 10.60.35.73 with SMTP id f9mr6121716oej.50.1389863881298; Thu, 16 Jan 2014 01:18:01 -0800 (PST) Received: by 10.182.29.38 with HTTP; Thu, 16 Jan 2014 01:18:01 -0800 (PST) In-Reply-To: <005001cf124f$3a40df00$aec29d00$@tutteli.ch> References: <001301cf1227$6d082ab0$47188010$@tutteli.ch> <002d01cf1234$01e6dc60$05b49520$@tutteli.ch> <004c01cf123d$35730870$a0591950$@tutteli.ch> <52D71748.1090402@googlemail.com> <52D71FAE.8030002@ajf.me> <005001cf124f$3a40df00$aec29d00$@tutteli.ch> Date: Thu, 16 Jan 2014 10:18:01 +0100 Message-ID: To: Robert Stoll Cc: Andrea Faulds , Crypto Compress , PHP internals Content-Type: multipart/alternative; boundary=089e013c6fa0ee598804f012e6d8 Subject: Re: [PHP-DEV] Introducing "Array Of" RFC From: martin.keckeis1@gmail.com (Martin Keckeis) --089e013c6fa0ee598804f012e6d8 Content-Type: text/plain; charset=UTF-8 2014/1/16 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 :) > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > + 1 for the RFC But if i'm not completely wrong, there is performance decrease instead of increase in your tests? https://gist.github.com/krakjoe/8444591 [joe@fiji php-src]$ sapi/cli/php isTest.php 10000 objects: 10000 arrayof: 0.00645113 instanceof: 0.00560713 --089e013c6fa0ee598804f012e6d8--