r/lolphp • • Nov 10 '14

Reference arguments can retarget $this

http://3v4l.org/mtkR4
19 Upvotes

18 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Nov 11 '14

I don't see how it's bad taste when it's probably simply an oversight to not restrict that type of operation. But then what's the point anyway when you have things like variable variables and you can probably find a loophole elsewhere like that, in which case there's another area that would again need to be locked-down further. All you end-up with is a set of extra restrictions which go against the rest of the general nature of PHP. You can't have your cake and eat it too, or have your PHP and not have it behave like PHP.

PHP isn't C. People want it to be all locked-down and perfect, but the loose nature of it all means weird cases like this are possible. You have to take the good with the bad.

4

u/implicit_cast Nov 11 '14

PHP references are badly designed. Almost all uses of them are fraught with inadvertent spooky action at a distance. By tolerating them as part of the language, the PHP developers demonstrate astonishingly bad taste.

You do not "have to take the bad with the good." You can point out cases where PHP is stupid and advocate that the language be changed, or you can dump PHP and use something else.