Hi!

3. I am already aware of several people within internals that believe any
version of this feature will result in uncontrolled chaos in PHP codebases.
I think this is false, as I do not see that kind of uncontrolled chaos in
the languages which do have this feature. However I would think that
allowing arbitrary overloads would increase that proportion.

Depends on how you define "uncontrolled chaos". I have encountered toolkits where the authors think it's cute to define "+" to mean something that has nothing to do with mathematical addition (go read the manual for an hour to figure what it actually does) or for += to mean something different than + and assignment. Some people even learn to love it, so far I haven't.

However, once a feature is added it is very difficult to change it. Not
only for backward compatibility reasons, but for the sheer inertia of the
massive impact that PHP has. I do not plan on ever proposing that arbitrary
symbol combinations be allowed for overloads myself. But I cannot possibly
know what internals might think of that possibility 10 years from now when
this feature has been in widespread usage for a long time. Using magic
methods makes it extremely difficult at *any* point in the future to allow
PHP developers the option of an overload for say +=+. What would such a

That's awesome. The only thing worse than a toolkit author that thinks it's cute to play with "+" is the one that thinks it's cute to invent some random combination of special characters and assign it some meaning that of course is obvious to the author, but unfortunately that's the only person in existence to whom is it obvious. Some people enjoy the code being a puzzle that you need to untangle and make a sherlockian detective work to even begin to understand what is going on in this code. Other people have work to do. And again, what's the intuitive difference between operators +=+@-+ and ++--=!* ?

Of course, of course I know, every feature can be abused. The difference here is that if it's hard to think about any use that wouldn't be an abuse.

That sounds far *less* maintainable to me. It seems more likely that even
if it were a desired feature 10 years from now, it would be something that
would be extremely difficult to implement, maintain, and pass.

I must notice "if" carries a lot of load here.
--
Stas Malyshev
smalys...@gmail.com

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

Reply via email to