Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33931 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63861 invoked by uid 1010); 11 Dec 2007 21:20:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 63846 invoked from network); 11 Dec 2007 21:20:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Dec 2007 21:20:39 -0000 Authentication-Results: pb1.pair.com header.from=markus@fischer.name; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=markus@fischer.name; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fischer.name from 213.46.255.22 cause and error) X-PHP-List-Original-Sender: markus@fischer.name X-Host-Fingerprint: 213.46.255.22 viefep18-int.chello.at Solaris 10 (beta) Received: from [213.46.255.22] ([213.46.255.22:40714] helo=viefep16-int.chello.at) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7A/3B-17330-52FFE574 for ; Tue, 11 Dec 2007 16:20:38 -0500 Received: from genuine.home ([213.47.124.167]) by viefep16-int.chello.at (InterMail vM.7.08.02.00 201-2186-121-20061213) with ESMTP id <20071211212034.XIVD13118.viefep16-int.chello.at@genuine.home>; Tue, 11 Dec 2007 22:20:34 +0100 Received: from chello213047124167.36.11.vie.surfer.at ([213.47.124.167] helo=[192.168.1.51]) by genuine.home with esmtpa (Exim 4.50) id 1J2CVU-0005SA-US; Tue, 11 Dec 2007 22:19:16 +0100 Message-ID: <475EFF1E.3030409@fischer.name> Date: Tue, 11 Dec 2007 22:20:30 +0100 User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Sam Barrow CC: internals@lists.php.net References: <698DE66518E7CA45812BD18E807866CEF88FDD@us-ex1.zend.net> <7d5a202f0712031900i386f8964s675da26cc93af3fe@mail.gmail.com> <47550FAB.30002@daylessday.org> <698DE66518E7CA45812BD18E807866CEF890ED@us-ex1.zend.net> <475578BE.40908@daylessday.org> <4755A797.1020905@lerdorf.com> <009001c836ae$4ba0add0$e2e20970$@mcnaught@synergy8.com> <4755B310.9070603@lerdorf.com> <4755B55A.1030708@zend.com> <4755B61A.2000803@lerdorf.com> <50921.98.193.37.55.1197080740.squirrel@www.l-i-e.com> <698DE66518E7CA45812BD18E807866CE0100C741@us-ex1.zend.net> <1197149903.9893.16.camel@sams-room> In-Reply-To: <1197149903.9893.16.camel@sams-room> X-Enigmail-Version: 0.95.5 OpenPGP: id=C2272BD0; url=http://markus.fischer.name/my_public_key.txt Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -30 X-Spam-Level: --- X-Spam-Report: Spam detection software, running on the system "genuine.home", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 For the record, I'm all for it. Optionality means flexibility. If one doesn't want to use it, he doesn't have to. Can you send a patch against 5.3 in CVS? [...] Content analysis details: (-3.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -3.3 ALL_TRUSTED Did not pass through any untrusted hosts -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0092] 2.0 RCVD_IN_SORBS_DUL RBL: SORBS: sent directly from dynamic IP address [213.47.124.167 listed in dnsbl.sorbs.net] 0.8 AWL AWL: From: address is in the auto white-list Subject: Re: [PHP-DEV] Type hinting From: markus@fischer.name (Markus Fischer) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 For the record, I'm all for it. Optionality means flexibility. If one doesn't want to use it, he doesn't have to. Can you send a patch against 5.3 in CVS? Have you thought about type hinting for return values? thanks, - - Markus Sam Barrow wrote: > A few weeks ago I wrote a message on this list about my patch for scalar > type hinting. I've been using it for about a month now in a large scale > application im developing with no problems. It allows type hinting for > the following types: int, float, string, bool (boolean), num (int or > float), scalar (int, float, string, or bool), object, and resource. > > All of these types have been very useful. Num has been useful for any > mathematical functions, scalar has been the most useful, mostly for > echoing values and interacting with the database (as a database cant > store arrays or objects). > > The type hinting is all 100% optional and has caused no problems for me > at all, I use it in most function but some functions I'll use it for one > parameter and not the other, or none at all with no problems. > > What is the general opinion on this? Examples below: > > > function multiply(num $a, num b) { > return $a * $b ; > } > > multiply(5, 1) ; // works > > multiply(3.7, 8.2) // works > > multiply("foo", 5) ; // Catchable fatal error: Argument 1 passed to > multiply() must be a number, string given > > function displayStuff(scalar $stuff) { > echo $stuff ; > } > > displayStuff('Hello!') ; // works > > displayStuff(123) ; // works > > displayStuff(array('a' => 'b')) ; // Catchable fatal error: Argument 1 > passed to displayStuff() must be a scalar, array given > > ?> > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHXv8e1nS0RcInK9ARApVaAJ9vwTTVdH+HNENA64wfaPbkyCyG9gCgrMuy CD2xQpN43p0dlgPIiYm2Ckg= =ZOm7 -----END PGP SIGNATURE-----