>> Interesting. So you are saying that once a word is a keyword in PHP, it
>> cannot be used as a name, anywhere? So for example, you are saying I
>> cannot create a variable called $function? If that is the case, that is
>> extremely odd. I would expect that get/set could be keywords when used
>> in
>> the right location (inside a property definition, but outside of the
>> property body), but anywhere else they should be able to be used as a
>> regular name... Is there some way that could be possible?
>
> A keyword in PHP means that it cannot be used as a name for something
> like a class/method/function etc. but of course still allowed in
> variable and constants (defined using define() -- not const as its
> compile time).
>
> class global { } /* fatal error */
> function default() { } /* fatal error */
Thanks for explaining that Kalle. I believe there is a way around this.
You mentioned using type-hinting syntax in an earlier email:
> You might also want to note in the RFC that "get" and "set" (which are
> very commonly used in userland code) will become keywords, unless you
> wish to take the same approach as with the current type hinting syntax
> we have in php-trunk that only makes type names have a meaning if they
> are in a prototype.
Could this easily be used (and would it make sense to use them) in this
situation? I think the best solution is for get/set to be keywords, but
only in the context of a property definition. Will this accomplish the
task?
- Dennis
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php