Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57005 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98504 invoked from network); 22 Dec 2011 15:29:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Dec 2011 15:29:14 -0000 Authentication-Results: pb1.pair.com smtp.mail=will.fitch@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=will.fitch@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.170 as permitted sender) X-PHP-List-Original-Sender: will.fitch@gmail.com X-Host-Fingerprint: 209.85.216.170 mail-qy0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:51662] helo=mail-qy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 21/34-12618-8CC43FE4 for ; Thu, 22 Dec 2011 10:29:13 -0500 Received: by qcsd16 with SMTP id d16so5422195qcs.29 for ; Thu, 22 Dec 2011 07:29:09 -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 :content-transfer-encoding:message-id:references:to:x-mailer; bh=7K3l2aV7cP5liPzbozkTZycql75u0JPn/cjW+y+2w3E=; b=Cbxo/AjinctxhrGBADUGpgfMr2P/pbKeNbPrgkp8bt2rEiv9qFBCxaZxWmArNjndw7 GrEgG5oDesSMgymZNq95UPWlr0HO2dqHkrNJkOOR6pmadY5pBhs4uf6cot3qYhmAXU77 6+CeMbxAuf9qAGrZkk+NILqftQ7txJvL79RsU= Received: by 10.224.44.130 with SMTP id a2mr14006125qaf.59.1324567749162; Thu, 22 Dec 2011 07:29:09 -0800 (PST) Received: from [192.168.1.68] ([68.64.144.221]) by mx.google.com with ESMTPS id v5sm17894623qao.21.2011.12.22.07.29.04 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Dec 2011 07:29:07 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=iso-8859-1 In-Reply-To: <006801ccc0bc$04e876b0$0eb96410$@alliantinternet.com> Date: Thu, 22 Dec 2011 10:29:04 -0500 Cc: "'Nikita Popov'" , "'Alain Williams'" , Content-Transfer-Encoding: quoted-printable Message-ID: 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> <20111222145159.GY25857@alliantinternet.com> <006101ccc0ba$46b81160$d4283420$@alliantinternet.com> <006801ccc0bc$04e876b0$0eb96410$@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) On Dec 22, 2011, at 10:11 AM, Dmitri Snytkine wrote: > I think the return type hinting really depends on variable type = hinting.=20 > A simple example whould bea typical getter function >=20 > public function \Customer getCustomer(){ > return $this->customer; > } The actual syntax would be:=20 public \Customer getCustomer() >=20 > If the $customer instance variable is not declared with the type = Customer > then first of all IDE will not be able to spot an error, second = compiler may > have a slighly harder time of detecting a mismatch. This isn't a compile time feature. The validation happens at runtime. = Many IDEs actually use PHP executables to detect syntax errors only. In = terms of code flow, they'll still need to rely on Doc comments and = lexical analysis. >=20 > I really believe that variable type hinting should be worked on at the = same > time or even before the type hinting for returns. >=20 > But it's not up to me of cause, just adding my thoughts to the = discussion of > this topic. I think this is a very important topic by the way. >=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: Nikita Popov [mailto:nikita.ppv@googlemail.com]=20 > Sent: Thursday, December 22, 2011 10:02 AM > To: Dmitri Snytkine > Cc: Alain Williams; internals@lists.php.net > Subject: Re: [PHP-DEV] Return Type Hinting for Methods RFC >=20 > Could we maybe keep this discussion contained to return value type > hints please? Optional variable type hinting is a completely different > topic that would require a separate RFC and implementation. If you are > interested in this you can propose a RFC for this. >=20 > Nikita >=20 > On Thu, Dec 22, 2011 at 3:59 PM, Dmitri Snytkine > wrote: >> I never said to make it mandatory, only to make it available. Just = like > the >> type hinting of function call is optional but not mandatory, which is = a > big >> advantage over Java in my opinion. >> After all, if you make return type hinting mandatory, it would break = 100% > of >> all existing php scripts. >>=20 >> To clarify I am asking to make type hinting for variable declaration = an >> available option. >>=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: Alain Williams [mailto:addw@phcomp.co.uk] >> Sent: Thursday, December 22, 2011 9:52 AM >> To: internals@lists.php.net >> Subject: Re: [PHP-DEV] Return Type Hinting for Methods RFC >>=20 >> On Thu, Dec 22, 2011 at 03:33:40PM +0100, Sebastian Krebs wrote: >>=20 >>>> private \ArrayObject $customers; >>>>=20 >>>=20 >>> Once more "Why is PHP not Java?" >>=20 >> That comment confuses matters. People use PHP for all sorts of = reasons, > the >> desire to tighten up in some places, on some occasions, should not be >> treated >> with derision. >>=20 >> Tighter declarations, or any declarations at all, would not be = mandatory. > It >> would >> be something that some projects might want to do. It would be nice if = this >> could be >> done on a module but module basis ... eg the implementors of a class > library >> might >> want to be really strict while allowing the class users to not be = strict. >>=20 >> Just because Java has a feature that you appear to not like, does not = mean >> that >> others might not want it in some circumstances. >>=20 >> -- >> Alain Williams >> Linux/GNU Consultant - Mail systems, Web sites, Networking, = Programmer, IT >> Lecturer. >> +44 (0) 787 668 0256 http://www.phcomp.co.uk/ >> Parliament Hill Computers Ltd. Registration Information: >> http://www.phcomp.co.uk/contact.php >> #include >>=20 >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >>=20 >>=20 >> -- >> 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