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 <[EMAIL PROTECTED]> wrote: > > 2007/11/18, Derick Rethans <[EMAIL PROTECTED]>: > > > > > 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 : > > > > <?php > > > > 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 > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php