On Wed, Aug 13, 2014 at 5:20 PM, Kalle Sommer Nielsen <ka...@php.net> wrote:
> Hi > > 2014-08-13 13:02 GMT+02:00 Ferenc Kovacs <tyr...@gmail.com>: > > agree, and I thought about mentioning that, but I left that out, because > > I'm not proposing to remove that ability (and I see more use-cases for > that > > as mentioned in my previous email) but stating that this patch would make > > an arbitrary distinction between the normal and the default cases. > > In PHP we already disallow overriding $this, like: > > class A { > public function B() { > $this = 'hello'; // error > ${'this'} = 'hello'; // error > ${'t' . 'his'} = 'hello'; // works > } > } > > so agreed too, we cannot disallow such cases that can be variable with > any gain, and it does make sense you cannot with $this, but if you > hack it like above, then you are asking for trouble anyway > > it is offtopic imo, but I also complained about that( https://bugs.php.net/bug.php?id=52428) but I think that it is a bit different beast, makes it harder for you to shot yourself to the foot, but the we couldn't find a way to completelly prevent you without noticable performance sacrifice if you go out your way to do so, so I think that the current best-effort approach is ok. -- Ferenc Kovács @Tyr43l - http://tyrael.hu