On Mon, Nov 14, 2011 at 7:27 AM, Rasmus Lerdorf <ras...@lerdorf.com> wrote:

> It could also easily be a step in the wrong direction if it isn't
> implemented carefully. Turning interchangeable scalar types into fake
> objects could introduce the equivalent of strong typing.

Indeed, that's not an easy thing to think about or design. Many cases
to clearly document or implement.

> Doing: $a=12; echo strlen($a); and getting 2 shouldn't suddenly break if
> you do it using $a->length() which means all scalar fake object methods
> would be available on all scalar objects regardless of their type.
> Otherwise it is just a sneaky way of introducing strict typing and that
> would cause a lot of pain for a lot of people.
>
> And while I know I floated the idea myself a while back, I'm not a fan
> of scalar objects at all. It's not like it cleans up the global
> namespace any, and given the requirement to maintain interchangeable
> basic scalar types it doesn't even provide clean per-scalar namespaces
> since all the methods would have to be in one.

They don't or shouldn't be object per se, it would be too slow
somehow. It won't cleanup the global namespace as there will have no
gain to drop the other functions, even if they are inconsistent.

However that's definitively something I would like to have, as it
makes the code cleaner and allows me to stop to have to rtfm for every
2nd scalar related function. But again, it is not a small task nor
easy, may never happen as well :)

Cheers,
-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to