On Mon, 3 Oct 2005, Dmitry Stogov wrote:

> At second disallowing such assignments and passign $this by reference will
> breake a lot of PHP4 code (Mamaba CMS).
> In PHP4 passing $object by refernce and by value had completely different
> semantic.

Yes I know. In PHP 4 the OO was totally crap, and now you're saying you 
want to keep "bogus" behavior for eternity so that all the PHP 4 apps 
can still run? 

I am quite getting tired of having to maintain BC for *every* little 
stupid thing we ever did. I think it's time to start with a clean slate 
as it's all getting way to annoying to maintain (and know what subtle 
differences there are between PHP versions). 

The same thing we now see with the unicode support in PHP 6 where we 
choose for maintaining BC with older PHP versions in every way possible. 
Now we get code like this:

        if (Z_TYPE_PP(str) == IS_UNICODE) {
            php_u_trim(Z_USTRVAL_PP(str), Z_USTRLEN_PP(str), 
Z_USTRVAL_PP(what), Z_USTRLEN_PP(what), return_value, mode TSRMLS_CC);
        } else {
            php_trim(Z_STRVAL_PP(str), Z_STRLEN_PP(str), Z_STRVAL_PP(what), 
Z_STRLEN_PP(what), Z_TYPE_PP(str), return_value, mode TSRMLS_CC);
        }

Which is in my opinion totally unmaintainable in the long run. I really 
think we would be much better of to get rid of IS_STRING and only have 
IS_BINARY and IS_UNICODE - do it the nice and clean way and forget about 
BC. We would definitely see the benefits in the long run. 

> 
> I don't see any reason to disallow 100% proper code (like the the
> following).
> 
> class Child {
>   function Child($parent) {
>     $parent->children[] =& $this;
>   }
> }
> 
> Of course using "=& $this" user can breake $this value, but other languages
> (C++) allows this too.

So if C++ allows this we should too? I think that's one invalid reason. 
There is no point of assigning by reference here, so we shouldn't allow 
that. That way our users see "oh, I did something wrong, let's fix it" - 
and yes, it will break BC. But the OO model in PHP 5 is totally 
different than in PHP 4, so I see no problems with that.

regards,
Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

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

Reply via email to