Re: by-ref return & inheritance

From: Date: Fri, 08 Aug 2008 23:59:10 +0000
Subject: Re: by-ref return & inheritance
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-39788@lists.php.net to get a copy of this message
hi! On Sat, Aug 9, 2008 at 1:50 AM, Stanislav Malyshev <stas@zend.com> wrote: > Hi! > >> I know that we don't like to add new magic methods, but this case >> seems to require new ones. What's about __getByRef (and its setter >> equivalent if it is also not supported yet)? > > Why would we need that? We already have perfectly good __get, which can > perfectly return by-ref. The question is only if we allow override __get > that was declared by-val with __get that is declared by-ref. I'm not sure to like the idea. I'm not a fan of OO strictness but I'd to agree with Marcus, I do not expect a reference from an overrided __get. There is also the problem with internal classes, if I'm not mistaken. > As for __set, __set doesn't return anything at all, so it's not very > relevant anyway. I meant set by reference. Is it not the same problem? class foo {function __set($key, &$value) {}} >> fatal error Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org

« previous php.internals (#39788) next »