Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37002 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33713 invoked from network); 14 Apr 2008 14:28:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Apr 2008 14:28:38 -0000 Authentication-Results: pb1.pair.com header.from=cschneid@cschneid.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=cschneid@cschneid.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain cschneid.com from 195.226.6.51 cause and error) X-PHP-List-Original-Sender: cschneid@cschneid.com X-Host-Fingerprint: 195.226.6.51 darkcity.gna.ch Linux 2.6 Received: from [195.226.6.51] ([195.226.6.51:44234] helo=mail.gna.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/74-11147-41A63084 for ; Mon, 14 Apr 2008 10:28:37 -0400 Received: from localhost (localhost [127.0.0.1]) by darkcity.gna.ch (Postfix) with ESMTP id 69C9F16EA46; Mon, 14 Apr 2008 16:28:33 +0200 (CEST) Received: from unknown by localhost (amavisd-new, unix socket) id client-XXoDSv1M; Mon, 14 Apr 2008 16:28:29 +0200 (CEST) Received: from box.local (84-72-92-81.dclient.hispeed.ch [84.72.92.81]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTP id 2DFDB16FB23; Mon, 14 Apr 2008 16:28:28 +0200 (CEST) Message-ID: <48036A0C.7070203@cschneid.com> Date: Mon, 14 Apr 2008 16:28:28 +0200 User-Agent: Thunderbird 2.0.0.12 (Macintosh/20080213) MIME-Version: 1.0 To: Chris Stockton CC: internals@lists.php.net References: <1207539695.5736.42.camel@pena> <8d7b8c130804062157j60871630r6c3b27c4d3245cb9@mail.gmail.com> <1207576676.5331.49.camel@felipe> <47FA507D.2070108@cschneid.com> <5CB53203-F3E5-46F2-89A8-F331B2CB9017@pooteeweet.org> <47FA60F8.7060702@zend.com> <37C655F0-D212-420C-9320-7953A69C5EDB@pooteeweet.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at gna.ch Subject: Re: [PHP-DEV] Return type hints From: cschneid@cschneid.com (Christian Schneider) Chris Stockton schrieb: > Why on earth would you have int, string, resource, etc "return type hints" > and then turn around and suggest for parameter hinting just add a scalar > type? That makes no sense and is so inconsistent. > > static int function retarded(scalar $value) { > return (int) $value; // lol.... > } Let me turn your question around: Why on earth would someone restrict a function to int when string works just as well? function int foo_flexible(scalar $x) { return $x + 42; } $foo = foo_flexible($value); function int foo_retarded(int $x) { return $x + 42; } $foo = foo_retarded((int)$value); # :-( That said, I'll be using function foo($x) { return $x + 42; } anyway and let PHP warnings take care of the rest ;-) - Chris