Re: Reserve even more type hints RFC

From: Date: Thu, 30 Apr 2015 12:27:57 +0000
Subject: Re: Reserve even more type hints RFC
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-86090@lists.php.net to get a copy of this message
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]

« previous php.internals (#86090) next »