Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26409 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60374 invoked by uid 1010); 7 Nov 2006 18:45:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 60357 invoked from network); 7 Nov 2006 18:45:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Nov 2006 18:45:49 -0000 Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=permerror; 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:3831] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BA/D2-40429-954D0554 for ; Tue, 07 Nov 2006 13:45:48 -0500 Received: (qmail 52362 invoked by uid 98); 7 Nov 2006 18:45:37 -0000 Received: from 127.0.0.1 by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-1.25 (clamdscan: 0.88.4/2171. Clear:RC:1(127.0.0.1):. Processed in 0.074011 secs); 07 Nov 2006 18:45:37 -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.074011 secs) Received: from unknown (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 7 Nov 2006 18:45:37 -0000 Received: from 208.195.234.246 (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Tue, 7 Nov 2006 12:45:37 -0600 (CST) Message-ID: <59809.208.195.234.246.1162925137.squirrel@www.l-i-e.com> In-Reply-To: <2F.C5.05668.5BD50554@pb1.pair.com> References: <7f3ed2c30611031000j2dc48a6amb7f04c8011442b56@mail.gmail.com> <282B7D4B-DC15-4ABC-95A6-C03F766C19B7@prohost.org> <27664.208.195.234.246.1162844322.squirrel@www.l-i-e.com> <10845a340611070126hdd3cfe1v4f62a37d98f620e1@mail.gmail.com> <2F.C5.05668.5BD50554@pb1.pair.com> Date: Tue, 7 Nov 2006 12:45:37 -0600 (CST) To: "Ron Korving" Cc: 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] [PATCH] Scalar type hinting ;) From: ceo@l-i-e.com ("Richard Lynch") On Tue, November 7, 2006 4:19 am, Ron Korving wrote: > I wouldn't like E_NOTICE. I agree that the result should be a NULL > value if > a conversion fails, Assume, for the sake of argument, that someday one's type-hint could be: function foo ([NULL | int] $bar){ } Also assume the paramter passed to $bar is '42' Then is converting to NULL really the right answer?... I don't have a BETTER answer, mind you... Seems to me, though, that if you're willing to turn on type-hinting, and you restrict your function to accept only [NULL | int], then I'd be more happy with PHP throwing something bigger than E_NOTICE and converting the input to NULL and carrying on... Seems to me, that once you commit to the type-hinting, a failed conversion oughta be E_ERROR... > I don't see a point in a hint called "mixed" either. You might as well > not > use a hint for that particular function parameter. You may need [mixed] if the PHP Manual under-documents what return values occur in the case of errors (which is the current state-of-the-art, really) and you don't know for sure what is going to come back, but you want something there, just so you know it's "not right yet" >> Sometime after that the facility to make the hints become enforcers. >> There would be a published list of conversion mechanisms (the >> equivalent PHP function in effect). You could potentially allow user >> defined conversions for user defined types though I would see this >> as >> a WIBNI, rather than a MH. WIBNI? MH? [shrug] I get the gist from context, but may be missing details... :-) -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?