Attributes on Enum Members: Call for use cases.
Seb
seb at wilzba.ch
Wed Nov 29 12:53:56 UTC 2017
On Tuesday, 28 November 2017 at 19:38:44 UTC, Meta wrote:
> On Tuesday, 28 November 2017 at 02:20:15 UTC, Michael V.
> Franklin wrote:
>> On Sunday, 19 November 2017 at 13:35:13 UTC, Michael V.
>> Franklin wrote:
>>
>>> What's the official word? Does it require a DIP?
>>
>> For those who might want to know, Walter has informed me that
>> this change will require a DIP. I already have two DIPs in
>> the queue right now, so I wouldn't mind if someone else wrote
>> it.
>>
>> But, absent any volunteers, I would welcome all of you to
>> reply to this thread with some use cases where you might find
>> UDAs or other attributes useful on enum members. Deprecation
>> and serialization have already been mentioned, but it'd be
>> impossible for me to imagine all the different ways users
>> might find this feature useful.
>>
>> Thanks,
>> Mike
>
> I'd be interested in working on a DIP like this Michael, but I
> also want to expand the scope to allowing UDAs on function
> arguments as well. We should have some solid use cases in mind;
> let's take this to private email.
UDAs for function arguments would be really awesome to have. Just
imagine how nice the Vibe.d web routes would look like:
auto postUser(@body User user, @errors Errors errors)
Instead of:
@body("user")
@errorDisplay
auto postUsers(User _user, string _error)
Or:
@path("/users/:id")
auto getUser(@urlParam string id, @queryParam int page, @auth
User user)
Instead of:
@path("/users/:id")
@queryParam("page")
@before!authenticate("user")
auto getUsers(string _id, int page, User user)
(This is pseudo-syntax as I write this from my phone).
More information about the Digitalmars-d
mailing list