Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37255 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57232 invoked from network); 26 Apr 2008 23:26:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Apr 2008 23:26:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=dz@bitxtender.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dz@bitxtender.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain bitxtender.com from 80.237.132.12 cause and error) X-PHP-List-Original-Sender: dz@bitxtender.com X-Host-Fingerprint: 80.237.132.12 wp005.webpack.hosteurope.de Received: from [80.237.132.12] ([80.237.132.12:60886] helo=wp005.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 29/D1-44564-32AB3184 for ; Sat, 26 Apr 2008 19:26:28 -0400 Received: from dslb-088-066-172-231.pools.arcor-ip.net ([88.66.172.231] helo=[192.168.0.100]); authenticated by wp005.webpack.hosteurope.de running ExIM using esmtpsa (TLSv1:RC4-SHA:128) id 1Jptmi-00060o-Ky; Sun, 27 Apr 2008 01:26:24 +0200 Cc: "Alain Williams" , internals@lists.php.net Message-ID: <64EF98DB-DB3C-44FD-BB1B-D051932F32C6@bitxtender.com> To: Nathan Nobbe In-Reply-To: <7dd2dc0b0804261524l22237b58tfb9d0a341ab77233@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v919.2) Date: Sun, 27 Apr 2008 01:26:24 +0200 References: <1209137410.6642.9.camel@sbarrow-desktop> <20080425182341.GB14490@mint.phcomp.co.uk> <1209149047.20639.18.camel@sbarrow-desktop> <48122C14.7070705@omegavortex.net> <1209150944.20639.24.camel@sbarrow-desktop> <7dd2dc0b0804251224s750679acn169637efbd8653fa@mail.gmail.com> <1209151505.20639.25.camel@sbarrow-desktop> <20080425231305.GC14490@mint.phcomp.co.uk> <9484717D-2EC6-44FF-93C8-1A9911294AF6@bitxtender.com> <7dd2dc0b0804261524l22237b58tfb9d0a341ab77233@mail.gmail.com> X-Mailer: Apple Mail (2.919.2) X-bounce-key: webpack.hosteurope.de;dz@bitxtender.com;1209252388;36eed885; Subject: Re: [PHP-DEV] Return type hinting patch From: dz@bitxtender.com (=?ISO-8859-1?Q?David_Z=FClke?=) Am 27.04.2008 um 00:24 schrieb Nathan Nobbe: > On Sat, Apr 26, 2008 at 2:06 PM, David Z=FClke =20 > wrote: > >> Wouldn't the most consistent way be to omit "function" altogether =20 >> when >> using a return type hint? >> >> public static function zomg() { >> return $somethingArbitrary; >> } >> >> public static string foo() { >> return $mustBeString; >> } >> > > i think leaving 'function' in there makes sense because thats the =20 > way php > currently works. Well that was my point. Functions without return type hints use =20 "function", to indicate that they are generic in this respect, and =20 functions/methods with a type hint omit it to signal the difference. =20 Having both would be redundant. But then...: >> otoh, should there ever be a type "function" (e.g. for anonymous =20 >> funcs) down >> the road, that'd mean trouble ;) > > > wow; good point! maybe if anonymous functions are ever supported =20 > the type > could be capitalized as in 'Function' > > public function Function doStuff() { > return function() {} > } Absolutely not. Right now, all PHP native types are lowercase. Can't =20 see why anon functions should be different. Actually, both ways have problems: public function gimmeThat() { return function() { echo 'yay'; } } is ambiguous if return type hints require omitting "function", and public function function gimmeThat() { ... } is just plain ugly. So maybe anon funcs should have a different type name :p David=