User Defined Attributes
Adam D. Ruppe
destructionator at gmail.com
Tue Nov 6 09:26:32 PST 2012
On Tuesday, 6 November 2012 at 17:16:34 UTC, Adam D. Ruppe wrote:
> [ExternalName("log-in")] /* we can do this now */
> void logIn([ExternalName("user-id")] string userId)
BTW we could conceivably do:
[ExternalName("log-in"),
ParameterAttribute!("userId")(ExternalName("user-id")]
void logIn(string userId) {}
Where the ParameterAttribute simply matches up the param by name
or by position (if you pass an int instead of string) and puts
the other argument in that map.
When you scan the function for attributes, you keep your eye open
for that ParameterAttribute thingy and match it up in the library.
So if it is too painful to put it in the compiler, we could make
it work in the library.
More information about the Digitalmars-d-announce
mailing list