Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56996 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82585 invoked from network); 22 Dec 2011 14:49:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Dec 2011 14:49:02 -0000 Authentication-Results: pb1.pair.com header.from=will.fitch@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=will.fitch@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.49 as permitted sender) X-PHP-List-Original-Sender: will.fitch@gmail.com X-Host-Fingerprint: 209.85.216.49 mail-qw0-f49.google.com Received: from [209.85.216.49] ([209.85.216.49:48486] helo=mail-qw0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 73/A0-12618-C5343FE4 for ; Thu, 22 Dec 2011 09:49:01 -0500 Received: by qadc14 with SMTP id c14so5777591qad.8 for ; Thu, 22 Dec 2011 06:48:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :message-id:references:to:x-mailer; bh=sHSge3ycA63+9zZlVYTMM/gsCUcWPdRk0LUoJjUQIck=; b=BqvCuZt2sIA9kBDBGkbjGStkjQQHPYzG9/7YdepDWQIdyIAQcWQHZG+g0OBl2kOS8J WtA/TOxgfKwObhL3ZxPpqbO5dACZN1sAHMyqSftCJJag2HXOK+eK/Mc35y2DkGiXzamp AKhKAX6+PbZo/+AnG97wtLIWpnLq1UVTw8Xzg= Received: by 10.224.33.65 with SMTP id g1mr13549447qad.98.1324565338467; Thu, 22 Dec 2011 06:48:58 -0800 (PST) Received: from [192.168.1.68] ([68.64.144.221]) by mx.google.com with ESMTPS id ft9sm17720500qab.20.2011.12.22.06.48.55 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Dec 2011 06:48:56 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: multipart/alternative; boundary="Apple-Mail=_70F065AD-E802-4402-A7F5-956A2AB76698" In-Reply-To: <005701ccc0b3$58c8dee0$0a5a9ca0$@alliantinternet.com> Date: Thu, 22 Dec 2011 09:48:54 -0500 Cc: "'Pierre Joye'" , "'Nikita Popov'" , "'PHP Developers Mailing List'" Message-ID: <68E7B0B2-6D57-4496-BD0E-7C6876460351@gmail.com> References: <2095305E-D4E3-4D7E-8218-32EE99688E0C@GMAIL.COM> <2C90FB94-38C4-4270-8C6A-B89304BA8ED8@gmail.com> <159A7CA2-8561-40DA-9434-CAAE12304DDB@gmail.com> <005701ccc0b3$58c8dee0$0a5a9ca0$@alliantinternet.com> To: "Dmitri Snytkine" X-Mailer: Apple Mail (2.1251.1) Subject: Re: [PHP-DEV] Return Type Hinting for Methods RFC From: will.fitch@gmail.com (Will Fitch) --Apple-Mail=_70F065AD-E802-4402-A7F5-956A2AB76698 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Dec 22, 2011, at 9:09 AM, Dmitri Snytkine wrote: > The return type hinting is probably the biggest thing happening in php = in a > long time. > Is this too good to be true? Hopefully not. We will see when the voting commences. :) >=20 > With return type hinting I can see a huge improvenets in php IDEs in > spotting errors. Also it will be much easier to auto generate wsdl = files > when return types are known to a compiler. > These are just to name a couple of important benefits that can come = out of > it. >=20 > What I don't see is any discussion of being able to declare the type = of > variable, you now, like in Java. > ie:=20 > private \ArrayObject $customers; Type hinting is relatively new to PHP, so we need to take careful steps = in moving forward. With the introduction of parameter type hinting 5.0, = and return type hinting following its lead, we will set ourselves up for = a good base for a type hinting API and structure. That said, PHP is not = Java, and type hinting in PHP is very different. It is, in fact, type = *hinting*. This is a runtime feature. Only interface validation is = verified at compile time, so we have to consider performance vs. feature = in these cases. >=20 > Also, is there an implicit "void" return type? The following types are allowed for both parameters and method returns: - Callable - Object (class name) - Array By not declaring a type hint with a parameter, it is considered mixed. = With method returns, simply using the keyword "function" as you have = been will signify mixed as well. >=20 > I hope that declaring types of variables will be added too because = without > it, this feature is not all that useful.=20 >=20 > Dmitri Snytkine > Web Developer > Ultra Logistics, Inc. > Phone: (888) 220-4640 x 2097 > Fax: (888) 795-6642 > E-Mail: dsnytkine@ultralogistics.com > Web: www.ultralogistics.com >=20 > "A Top 100 Logistics I.T. Provider in 2011" >=20 >=20 > -----Original Message----- > From: Will Fitch [mailto:will.fitch@gmail.com]=20 > Sent: Wednesday, December 21, 2011 5:29 PM > To: Pierre Joye > Cc: Nikita Popov; PHP Developers Mailing List > Subject: Re: [PHP-DEV] Return Type Hinting for Methods RFC >=20 > Hi Pierre and Nikita, >=20 > I have added callable to the patch and updated the RFC entry to = reflect the > changes. Please verify and let me know if you have any issues. >=20 > On Dec 21, 2011, at 2:33 PM, Pierre Joye wrote: >=20 >> hi Will, >>=20 >> You should add it now, while 5.4 final is not released yet, this >> feature exists already and should be part of the RFC, to be complete. >>=20 >> Cheers, >>=20 >> On Wed, Dec 21, 2011 at 6:22 PM, Will Fitch = wrote: >>> Hi Nikita, >>>=20 >>> I didn't add that as it's not yet in production. As soon as things = are > finalized and 5.4 is GA, I will gladly add the callable type hint. = The > change wouldn't be different from parameter type hinting, and can = easily be > added. >>>=20 >>> On Dec 21, 2011, at 12:17 PM, Nikita Popov wrote: >>>=20 >>>> Hi Will! >>>>=20 >>>> One random thought I had while reading the RFC is: What about the >>>> newly introduced callable typehint? Is this missing by intention? I >>>> could well imagine so (because it's hard to check what scope >>>> callability should be checked on), but wanted to be sure on that. >>>>=20 >>>> Nikita >>>>=20 >>>> On Wed, Dec 21, 2011 at 3:09 AM, Will Fitch > wrote: >>>>> Hello All, >>>>>=20 >>>>> I would like to submit https://wiki.php.net/rfc/returntypehint2 = into > discussion. A link to the patch for this is provided and can be ran = against > the current HEAD. >>>>>=20 >>>>> There is an older entry still in existence, but this patch is > syntactically different. The older entry is located at > https://wiki.php.net/rfc/typechecking and is bundled with parameter, > scalars, etc. >>>>>=20 >>>>> If possible, can someone promote this to the "Under Discussion" > category within https://wiki.php.net/rfc? >>>>>=20 >>>>> -- Will >>>>> -- >>>>> PHP Internals - PHP Runtime Development Mailing List >>>>> To unsubscribe, visit: http://www.php.net/unsub.php >>>>>=20 >>>=20 >>>=20 >>> -- >>> PHP Internals - PHP Runtime Development Mailing List >>> To unsubscribe, visit: http://www.php.net/unsub.php >>>=20 >>=20 >>=20 >>=20 >> --=20 >> Pierre >>=20 >> @pierrejoye | http://blog.thepimp.net | http://www.libgd.org >=20 >=20 > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20 --Apple-Mail=_70F065AD-E802-4402-A7F5-956A2AB76698--