Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71151 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33343 invoked from network); 15 Jan 2014 20:09:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2014 20:09:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=pjsturgeon@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pjsturgeon@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.195 as permitted sender) X-PHP-List-Original-Sender: pjsturgeon@gmail.com X-Host-Fingerprint: 209.85.217.195 mail-lb0-f195.google.com Received: from [209.85.217.195] ([209.85.217.195:39982] helo=mail-lb0-f195.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 19/D7-26701-D0BE6D25 for ; Wed, 15 Jan 2014 15:09:50 -0500 Received: by mail-lb0-f195.google.com with SMTP id z5so283851lbh.10 for ; Wed, 15 Jan 2014 12:09:45 -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=qFcFRX8Mcse+Q9EIl3WHyg/7q2qlQXiWE2F4U4e4RR8=; b=WJYThQr/Tjk5z43LnRa7aESKc4ykoDV6A/HMhREaIiiR3x/TEg+2mjOi0/IABbR9dr FRYCt3mthh7M9ogkkk5o7Lszqx8nD70w0KYzJhck4YYExOZkis8PFr1lvi0c3wO7Y9r0 rVelm1Fg5IHLIxfvjGknodVyGGi1xlB987q2XuHF8rnjj+Fxu2pYqUh3FPtGVvApFIxx Kdo9HMwHNVYfmT3wby8SdPatKnQMV4sh85ij4ok9Q3YZp1JN2CtXX9iee3gjZG3OZ7On yVt4rvQQzP4idM2S8V2VLEJl8jgy4a1TCrY+8d9Mjn7Cl2ESh5cBrZyAc/ON4f0M+Dka cjTQ== MIME-Version: 1.0 X-Received: by 10.152.180.35 with SMTP id dl3mr81814lac.66.1389816585829; Wed, 15 Jan 2014 12:09:45 -0800 (PST) Received: by 10.114.93.231 with HTTP; Wed, 15 Jan 2014 12:09:45 -0800 (PST) In-Reply-To: <001301cf1227$6d082ab0$47188010$@tutteli.ch> References: <001301cf1227$6d082ab0$47188010$@tutteli.ch> Date: Wed, 15 Jan 2014 15:09:45 -0500 Message-ID: To: Robert Stoll Cc: "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Introducing "Array Of" RFC From: pjsturgeon@gmail.com (Philip Sturgeon) On Wed, Jan 15, 2014 at 2:24 PM, Robert Stoll wrote: > Hey, > >> -----Original Message----- >> From: Philip Sturgeon [mailto:pjsturgeon@gmail.com] >> Sent: Wednesday, January 15, 2014 7:18 PM >> To: internals@lists.php.net >> Subject: [PHP-DEV] Introducing "Array Of" RFC >> >> Hey, >> >> This is my first RFC so give me a little leeway if I get things wrong. >> >> https://wiki.php.net/rfc/arrayof >> >> The implementation has been written by Joe Watkins, and I will be >> handling the RFC process for him. >> >> It is aimed at PHP 5.6, and so far the release managers seem to be ok >> with the idea of this potentially being merged after the alpha >> release, so this should not be considered an issue. >> >> Everything is open for discussion, especially the current error >> messages. They are not perfect, so let us know if you have better >> ideas. >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php > > First of all, I really like the RFC, good idea, well done. > > But about some details. I am not sure if I got the implementation right (haven't done any code contributions so far, so > I am not really familiar with the source code) but it seems that a check for NULL is implemented for the actual > parameter which is perfectly fine (done for other type hints as well) but it also checks if all members of an array are > not NULL and the check returns a failure if NULL is detected. I think that's wrong, NULL is a perfect valid entry in an > array. > > Furthermore, what about type hints like the following ones: > function foo(int[] $qualities, callable[] $callables){} > > Seems like they are not supported. But might be that I am totally wrong and did not understand the code > Ok, ignoring the int stuff as PHP doesn't generally do that. We don't want to broach that topic here. As for allowing null, this feature is currently intended as a syntactic representation of: foreach ($foos as $foo) { if (! $foo instanceof Face) { throw new Exception ('AAAGGGGGHHH!'); } } You are suggesting: foreach ($foos as $foo) { if (! is_null($foo) and ! $foo instanceof Face) { throw new Exception ('AAAGGGGGHHH!'); } } How do people feel about that?