Re: Attributes on Enum Members: Call for use cases.

2018-01-02 Thread Seb via Digitalmars-d
On Wednesday, 29 November 2017 at 14:23:30 UTC, Michael V. Franklin wrote: On Tuesday, 28 November 2017 at 19:38:44 UTC, Meta wrote: 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

Re: Attributes on Enum Members: Call for use cases.

2017-11-30 Thread Timon Gehr via Digitalmars-d
On 30.11.2017 15:19, Steven Schveighoffer wrote: On 11/30/17 3:26 AM, Timon Gehr wrote: On 30.11.2017 00:23, Steven Schveighoffer wrote: Looking at std.traits, it looks like we use this mechanism to get everything: int func(int param1) static if(is(typeof(func) F == __parameters)) {

Re: Attributes on Enum Members: Call for use cases.

2017-11-30 Thread Steven Schveighoffer via Digitalmars-d
On 11/30/17 3:34 AM, Timon Gehr wrote: On 29.11.2017 20:49, Steven Schveighoffer wrote: I would say: struct attribute1{} struct attribute2{} int foo(@attribute1 int x){ return x; } int bar(@attribute2 int y){ return y; } pragma(msg, typeof()); // int function(@attribute1 int x)? int

Re: Attributes on Enum Members: Call for use cases.

2017-11-30 Thread Steven Schveighoffer via Digitalmars-d
On 11/30/17 3:26 AM, Timon Gehr wrote: On 30.11.2017 00:23, Steven Schveighoffer wrote: Looking at std.traits, it looks like we use this mechanism to get everything: int func(int param1) static if(is(typeof(func) F == __parameters)) { static assert(is(typeof(F[0]) == int)); static

Re: Attributes on Enum Members: Call for use cases.

2017-11-30 Thread Timon Gehr via Digitalmars-d
On 29.11.2017 20:49, Steven Schveighoffer wrote: I would say: struct attribute1{} struct attribute2{} int foo(@attribute1 int x){ return x; } int bar(@attribute2 int y){ return y; } pragma(msg, typeof()); // int function(@attribute1 int x)? int function(int) ... Your suggestion is

Re: Attributes on Enum Members: Call for use cases.

2017-11-30 Thread Timon Gehr via Digitalmars-d
On 30.11.2017 00:23, Steven Schveighoffer wrote: On 11/29/17 4:46 PM, Timon Gehr wrote: On 29.11.2017 20:49, Steven Schveighoffer wrote: On 11/29/17 2:01 PM, Timon Gehr wrote: OK, now I get what you are saying. In the same vein, I tested applying attributes to functions themselves: @("a")

Re: Attributes on Enum Members: Call for use cases.

2017-11-29 Thread Steven Schveighoffer via Digitalmars-d
On 11/29/17 4:46 PM, Timon Gehr wrote: On 29.11.2017 20:49, Steven Schveighoffer wrote: On 11/29/17 2:01 PM, Timon Gehr wrote: OK, now I get what you are saying. In the same vein, I tested applying attributes to functions themselves: @("a") int fun() { return 0; } pragma(msg, typeof()); //

Re: Attributes on Enum Members: Call for use cases.

2017-11-29 Thread John via Digitalmars-d
On Wednesday, 29 November 2017 at 21:46:51 UTC, Timon Gehr wrote: On 29.11.2017 20:49, Steven Schveighoffer wrote: On 11/29/17 2:01 PM, Timon Gehr wrote: OK, now I get what you are saying. In the same vein, I tested applying attributes to functions themselves: @("a") int fun() { return 0; }

Re: Attributes on Enum Members: Call for use cases.

2017-11-29 Thread Timon Gehr via Digitalmars-d
On 29.11.2017 20:49, Steven Schveighoffer wrote: On 11/29/17 2:01 PM, Timon Gehr wrote: OK, now I get what you are saying. In the same vein, I tested applying attributes to functions themselves: @("a") int fun() { return 0; } pragma(msg, typeof()); // int function() @("b") int gun() {

Re: Attributes on Enum Members: Call for use cases.

2017-11-29 Thread Steven Schveighoffer via Digitalmars-d
On 11/29/17 2:01 PM, Timon Gehr wrote: OK, now I get what you are saying. In the same vein, I tested applying attributes to functions themselves: @("a") int fun() { return 0; } pragma(msg, typeof()); // int function() @("b") int gun() { return 1; } pragma(msg, typeof()); // int function()

Re: Attributes on Enum Members: Call for use cases.

2017-11-29 Thread Timon Gehr via Digitalmars-d
On 29.11.2017 19:18, Steven Schveighoffer wrote: On 11/29/17 12:20 PM, Timon Gehr wrote: I don't understand what you mean. Function types _contain_ parameter declarations. (Including attributes and default initializers.) I too, am confused. I thought you meant that the types of the

Re: Attributes on Enum Members: Call for use cases.

2017-11-29 Thread Steven Schveighoffer via Digitalmars-d
On 11/29/17 12:20 PM, Timon Gehr wrote: I don't understand what you mean. Function types _contain_ parameter declarations. (Including attributes and default initializers.) I too, am confused. I thought you meant that the types of the parameters would have attributes that might

Re: Attributes on Enum Members: Call for use cases.

2017-11-29 Thread Timon Gehr via Digitalmars-d
On 29.11.2017 17:58, Steven Schveighoffer wrote: On 11/29/17 11:45 AM, Timon Gehr wrote: On 29.11.2017 17:21, Andrei Alexandrescu wrote: On 11/29/2017 07:53 AM, Seb wrote: UDAs for function arguments would be really awesome to have. They should be part of the same DIP. -- Andrei More

Re: Attributes on Enum Members: Call for use cases.

2017-11-29 Thread Meta via Digitalmars-d
On Wednesday, 29 November 2017 at 16:45:04 UTC, Timon Gehr wrote: On 29.11.2017 17:21, Andrei Alexandrescu wrote: On 11/29/2017 07:53 AM, Seb wrote: UDAs for function arguments would be really awesome to have. They should be part of the same DIP. -- Andrei More generally, any declaration

Re: Attributes on Enum Members: Call for use cases.

2017-11-29 Thread Steven Schveighoffer via Digitalmars-d
On 11/29/17 11:45 AM, Timon Gehr wrote: On 29.11.2017 17:21, Andrei Alexandrescu wrote: On 11/29/2017 07:53 AM, Seb wrote: UDAs for function arguments would be really awesome to have. They should be part of the same DIP. -- Andrei More generally, any declaration should ideally support

Re: Attributes on Enum Members: Call for use cases.

2017-11-29 Thread Timon Gehr via Digitalmars-d
On 29.11.2017 17:21, Andrei Alexandrescu wrote: On 11/29/2017 07:53 AM, Seb wrote: UDAs for function arguments would be really awesome to have. They should be part of the same DIP. -- Andrei More generally, any declaration should ideally support UDAs. One issue with UDAs on function

Re: Attributes on Enum Members: Call for use cases.

2017-11-29 Thread Andrei Alexandrescu via Digitalmars-d
On 11/29/2017 07:53 AM, Seb wrote: UDAs for function arguments would be really awesome to have. They should be part of the same DIP. -- Andrei

Re: Attributes on Enum Members: Call for use cases.

2017-11-29 Thread Jacob Carlborg via Digitalmars-d
On 2017-11-29 13:53, Seb wrote: 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)

Re: Attributes on Enum Members: Call for use cases.

2017-11-29 Thread Michael V. Franklin via Digitalmars-d
On Tuesday, 28 November 2017 at 19:38:44 UTC, Meta wrote: 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. I'm on IRC

Re: Attributes on Enum Members: Call for use cases.

2017-11-29 Thread Seb via Digitalmars-d
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,

Re: Attributes on Enum Members: Call for use cases.

2017-11-28 Thread Meta via Digitalmars-d
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.

Re: Attributes on Enum Members: Call for use cases.

2017-11-28 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, November 28, 2017 18:24:27 Jacob Carlborg via Digitalmars-d wrote: > On 2017-11-28 03:20, Michael V. Franklin wrote: > > For those who might want to know, Walter has informed me that this > > change will require a DIP. > > That's unfortunate. It should be the opposite, a DIP on why

Re: Attributes on Enum Members: Call for use cases.

2017-11-28 Thread Jacob Carlborg via Digitalmars-d
On 2017-11-28 03:20, Michael V. Franklin wrote: For those who might want to know, Walter has informed me that this change will require a DIP. That's unfortunate. It should be the opposite, a DIP on why enum members should not support attributes. It goes against consistency (turtles all the

Attributes on Enum Members: Call for use cases.

2017-11-27 Thread Michael V. Franklin via Digitalmars-d
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