On 24/02/12 17:46, Dmitri Snytkine wrote:
> In order to intoduce the enum into php, 'enum' will have to be a keyword like 
> 'class', 'interface', etc.
>
> Just a thought, but could there be a problem with using the new keyword 
> 'enum' in php.  I don't think it's currently a reserved word, so it could 
> potentially cause problems if a script uses the word enum for existing 
> variable name or a function or a class name?
>
>
> Dmitri Snytkine
I think it would be _possible_ to handle it in a completely backwards
compatible way, as no valid usage would conflict with new one, and
context could disambiguate them.

A variable called enum would be $enum, so no problem there, but
currently you could have enum in these contexts:
function enum (...) {
class enum {
interface enum {

and the new usage would be like:
enum <name> {

Also, you could have defined a constant called enum, but makes no sense
to use it at the beginning of a sentence.


That said, it would be hard to support such usages compared to the given
gain, so I suppose it would just produce a parser error about T_ENUM in
the above scenarios.



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

Reply via email to