Florian Margaine wrote on 30/04/2015 10:23:
> > We don't need a warning there, we need a fatal error. These names are
> > *invalid* as class names.
> Should we throw fatal errors for functions starting with 2
underscores too?
Actually, soft reservation has genuine advantages for those:
1) It allows forwards compatibility - you can add an __debugInfo()
method to a project which supports PHP 5.5, even though it will never be
used until PHP 5.6. Since we have no conditional compilation, there's no
other way of enabling the feature only if it's available.
2) It can be used to implement userland compatibility shims. For
instance, a framework's enhanced dump function could manually call
__debugInfo() on versions <5.6, or an event handling framework could
accept objects with an __invoke() method as callbacks on PHP 5.2.
I can think of no such advantage with reserved keywords for basic types,
since there is no way to use them in current code which would be
compatible with their future use.
Regards,
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php