Re: [RFC] [Discussion] nameof

From: Date: Thu, 25 May 2023 19:32:29 +0000
Subject: Re: [RFC] [Discussion] nameof
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-120400@lists.php.net to get a copy of this message
> Using a :: pseudo-constant suffix rather than a ()-based construct would help with the syntax > clumsiness in both cases, but wouldn't entirely eliminate it. I don't have a really great > answer here, unfortunately. I think I'd marginally prefer a ::name suffix at this point just > for syntactic convenience, but I'm still undecided if the overall tradeoff is worth it. (For > ::name, probably, as that would be a much lighter syntax impact for those unusual cases that > it's needed.) I believe Lydia suggested something like that, and while I kinda liked the syntax (better than nameof() for wordy-looking bits), it just looked weird to me. I'm not dismissing it out of hand though. There might even be some middle ground where nameof() only works on functions/constants, while methods/properties have a ::name pseudo constant. I'll have to play with it and how it feels.

« previous php.internals (#120400) next »