Re: Autoboxing in php 5.1
| From: | Ante Drnasin | Date: | Wed, 09 Feb 2005 11:08:08 +0000 |
| Subject: | Re: Autoboxing in php 5.1 | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-14746@lists.php.net to get a copy of this message | ||
Hi Marcus and thanx for the explanation....
And I agree that PHP is very loose which is his strong part but
exactly because of that I think it would be nice if the end-user can have
the ability to work with primitives like they were objects...
I didn't want to suggest that PHP should implement Autoboxing as JAVA
but I did like the concept of having objects for primitive types....
Marcus Boerger wrote:
Hello Ante, autoboxing is an ugly java 1.5 workarount to enable storage of base tyoes in containers. There this trick is necessary because as always in java everything must be an 'Object'. In contrast PHP is a loosly typed language where a container aka array can store any type. Apart from that as with java there is no user space enabled way to implement such autoboxing types and even the java way of building it into the engine is not supported and won't be. regards marcus Monday, February 7, 2005, 3:21:59 PM, you wrote:I was wondering if anyone can comment on this idea cause I think it would be a great asset to PHP and to OOP in PHP..example:$b = 4; $a = new Integer(4);if($a == $b) { //bla bla }Other classes would include String(), Integer(), Boolean() ... and so on...