User Defined Attributes
Adam D. Ruppe
destructionator at gmail.com
Tue Nov 6 09:16:33 PST 2012
On Tuesday, 6 November 2012 at 16:41:22 UTC, Walter Bright wrote:
> It would be a significant extension, and so I'd like to see a
> compelling use case first.
What do you consider to be compelling use cases for UDAs on
functions?
Going back to the links on the original post, we have:
"I have numerous systems that need to scan the module for things
marked accordingly to automate bindings to their respective
systems."
Putting them on parameters also helps with this. Script languages
have to deal with parameters. Editors might. And, of course, I've
already talked about automatic UI generation.
Here's another one: named parameters. Of course, there's D names,
but suppose you have to hook into another naming scheme that uses
characters that aren't valid D names?
An external system might send you "log-in?user-id=foo". You are
doing a library to automatically call a class:
class Handler {
[ExternalName("log-in")] /* we can do this now */
void logIn([ExternalName("user-id")] string userId) {}
/* but the parameter, which is the same concept, doesn't
work */
}
More information about the Digitalmars-d-announce
mailing list