Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25872 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65501 invoked by uid 1010); 28 Sep 2006 19:54:02 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 65486 invoked from network); 28 Sep 2006 19:54:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Sep 2006 19:54:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain l-i-e.com from 67.139.134.202 cause and error) X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from [67.139.134.202] ([67.139.134.202:1053] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FB/C7-21168-9582C154 for ; Thu, 28 Sep 2006 15:54:02 -0400 Received: (qmail 63101 invoked by uid 98); 28 Sep 2006 19:54:02 -0000 Received: from 127.0.0.1 by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-1.25 (clamdscan: 0.88.4/1948. Clear:RC:1(127.0.0.1):. Processed in 0.071242 secs); 28 Sep 2006 19:54:02 -0000 X-Qmail-Scanner-Mail-From: ceo@l-i-e.com via o2.hostbaby.com X-Qmail-Scanner: 1.25 (Clear:RC:1(127.0.0.1):. Processed in 0.071242 secs) Received: from unknown (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 28 Sep 2006 19:54:02 -0000 Received: from 208.195.234.254 (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Thu, 28 Sep 2006 14:54:02 -0500 (CDT) Message-ID: <29631.208.195.234.254.1159473242.squirrel@www.l-i-e.com> In-Reply-To: <10845a340609130401q20127db0yf8e30f781622c63@mail.gmail.com> References: <0a1301c6d64f$8af01c70$a900000a@adstate.local> <74293252.20060912230042@marcus-boerger.de> <00b501c6d6b4$632b7e90$9a02a8c0@pc> <10845a340609130053n395632f4ka5bbed3e49ce6ad2@mail.gmail.com> <0d4001c6d71a$fa124260$a900000a@adstate.local> <10845a340609130401q20127db0yf8e30f781622c63@mail.gmail.com> Date: Thu, 28 Sep 2006 14:54:02 -0500 (CDT) To: RQuadling@GoogleMail.com Cc: Terje =?iso-8859-1?Q?Sletteb=C3=B8?= , "Marcus Boerger" , internals@lists.php.net Reply-To: ceo@l-i-e.com User-Agent: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] Return type hints From: ceo@l-i-e.com ("Richard Lynch") On Wed, September 13, 2006 6:01 am, Richard Quadling wrote: > The issue then becomes what would happen to a value of the wrong type? > > You either have the option of using PHP's own internal casting > mechanism, so f(int $i_int_expected) would internally cast the > supplied parameter as an int or you have to produce a WARNING with a > "parameter of the wrong type" message. But then what is passed to the > function? This would have to be determined somehow. Could I just point out that MANY PHP functions do things like this: /* returns int for blah blah * returns false in case of error */ function foo($x){ if (world_has_ended()) return false; } So if you're going to insist on type hints, can we not at least make it sensible and have syntax like: int|bool function foo (){ } So foo() returns int or bool. Otherwise, you end up with (int) false strewn all through your code, and it looks all messy. There's a REASON why I'm writing PHP and not C, folks... :-) -- Like Music? http://l-i-e.com/artists.htm