Re: Proposal for new construct: nameof
| From: | Edward Z. Yang | Date: | Wed, 29 Oct 2008 19:50:59 +0000 |
| Subject: | Re: Proposal for new construct: nameof | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-41563@lists.php.net to get a copy of this message | ||
Stan Vassilev | FM wrote:
> I suggest we introduce a new construct which will return a string when passed any identifier to
> resolve against the current file's use clauses:
>
> nameof Symbol\Name;
>
> With this identifier, the above example can be "normalized" to the following code:
I second this suggestion. One thing that would be awesome is if we could
drop nameof completely (i.e. all class/function names are first class
data) like F::loadFunc(B\Baz), but I doubt it would be possible with the
parser (at the very least, it wouldn't work for items without a
namespace separator, since it could be construed as a constant).
Cheers,
Edward