Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37257 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64351 invoked from network); 27 Apr 2008 00:20:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Apr 2008 00:20:54 -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:58511] helo=wp005.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 48/33-44564-4E6C3184 for ; Sat, 26 Apr 2008 20:20:53 -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 1JpudN-0004St-6p; Sun, 27 Apr 2008 02:20:49 +0200 Cc: "Nathan Nobbe" , "Alain Williams" , internals@lists.php.net Message-ID: To: "Chris Stockton" In-Reply-To: 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 02:20:48 +0200 References: <1209137410.6642.9.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> <64EF98DB-DB3C-44FD-BB1B-D051932F32C6@bitxtender.com> X-Mailer: Apple Mail (2.919.2) X-bounce-key: webpack.hosteurope.de;dz@bitxtender.com;1209255653;f415906f; Subject: Re: [PHP-DEV] Return type hinting patch From: dz@bitxtender.com (=?ISO-8859-1?Q?David_Z=FClke?=) But anonymous functions and lambda expressions are not the same thing... David Am 27.04.2008 um 02:11 schrieb Chris Stockton: > *cough* lambda *cough* > > On Sat, Apr 26, 2008 at 4:26 PM, David Z=FClke =20 > wrote: > 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 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 > > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >