Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33269 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11757 invoked by uid 1010); 18 Nov 2007 23:34:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 11731 invoked from network); 18 Nov 2007 23:34:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Nov 2007 23:34:39 -0000 Authentication-Results: pb1.pair.com header.from=sam@sambarrow.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=sam@sambarrow.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain sambarrow.com from 205.234.132.11 cause and error) X-PHP-List-Original-Sender: sam@sambarrow.com X-Host-Fingerprint: 205.234.132.11 scottsdale.servershost.net Received: from [205.234.132.11] ([205.234.132.11:36635] helo=scottsdale.servershost.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5C/32-31009-50CC0474 for ; Sun, 18 Nov 2007 18:34:34 -0500 Received: from [216.15.51.211] (port=50907 helo=[192.168.1.90]) by scottsdale.servershost.net with esmtpsa (SSLv3:RC4-MD5:128) (Exim 4.68) (envelope-from ) id 1Ittei-0005HQ-Cw; Sun, 18 Nov 2007 17:34:24 -0600 To: David Coallier Cc: Cristian Rodriguez , internals@lists.php.net In-Reply-To: References: <1195140437.23612.5.camel@sbarrow-desktop> <10610581037.20071115172619@marcus-boerger.de> <7d5a202f0711181452h3b6a26b8x5b838b585c552765@mail.gmail.com> Content-Type: text/plain Date: Sun, 18 Nov 2007 18:34:34 -0500 Message-ID: <1195428874.4686.4.camel@sams-room> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - scottsdale.servershost.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - sambarrow.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] [PATCH] Optional scalar type hinting From: sam@sambarrow.com (Sam Barrow) I have thought about this, using obects for all variables, but all of the extra code amounts to alot in a large application, and when using hundreds of small strings and integers scattered throughtout your application, this would cause a serious performance drop. On Sun, 2007-11-18 at 18:13 -0500, David Coallier wrote: > On Nov 18, 2007 5:52 PM, Cristian Rodriguez wrote: > > 2007/11/18, Derick Rethans : > > > > > I am actually thinking that it might be a good thing to add more and > > > more. I know my quick hack isn't the best implementation though. > > > > Yes and it is an alternative and not a mandatory thing to use.. as long as : > > > > > > > function foo(int $num) { > > return $num > > > > } > > > > foo("12345") // emit fatal error, NOT accept it as valid integer > > > > all is fine and Im all for it ;) > > -- > > http://www.kissofjudas.net/ > > > > I was thinking at something along the lines of objects also for instance: > > $i = new Integer(33); > > function foo(Integer $var) { > } > > foo ($i); else it emits a fatal error. But also if you do > > $i = "Name"; that would emit a fatal error because the value is > suposed to be an int. This might look a bit too much like java, but as > an extension it could be something quite interesting I believe. > > String, Object, Integer, Scalar, Float and what else. > > So thinking of something like > > $string = new String("Foo"); > $string = "bar" or $string->setValue("Bar"); would do > > $float = new Float(4.242); > $float->setValue('foobar'); // That emits an error > $float->setValue(3.14159); > > echo $float; (__toString) or echo $float->getValue; to echo it's content/value > > and so on. > > Would that be "too" java-ish to be something considered in php6 ? ;-) > > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- > David Coallier, > Founder & Software Architect, > Agora Production (http://agoraproduction.com) > 51.42.06.70.18 >