Re: DIP1001: DoExpression

2016-09-07 Thread Timon Gehr via Digitalmars-d
On 07.09.2016 14:19, Marc Schütz wrote: On Tuesday, 6 September 2016 at 17:01:28 UTC, Timon Gehr wrote: There can be no field (or variables) of type 'void'. (void,void,T) has two fields of type 'void'. Just fixing the limitations is also not really possible, as e.g. void* and void[] exploit

Re: DIP1001: DoExpression

2016-09-07 Thread Marc Schütz via Digitalmars-d
On Tuesday, 6 September 2016 at 17:01:28 UTC, Timon Gehr wrote: There can be no field (or variables) of type 'void'. (void,void,T) has two fields of type 'void'. Just fixing the limitations is also not really possible, as e.g. void* and void[] exploit that 'void' is special and have a

Re: DIP1001: DoExpression

2016-09-06 Thread Timon Gehr via Digitalmars-d
On 06.09.2016 17:23, Steven Schveighoffer wrote: On 9/6/16 10:17 AM, Timon Gehr wrote: On 06.09.2016 16:12, Steven Schveighoffer wrote: I'm not sure I agree with the general principal of the DIP though. I've never liked comma expressions, and this seems like a waste of syntax. Won't tuples

Re: DIP1001: DoExpression

2016-09-06 Thread Steven Schveighoffer via Digitalmars-d
On 9/6/16 1:01 PM, Timon Gehr wrote: On 06.09.2016 17:23, Steven Schveighoffer wrote: On 9/6/16 10:17 AM, Timon Gehr wrote: On 06.09.2016 16:12, Steven Schveighoffer wrote: I'm not sure I agree with the general principal of the DIP though. I've never liked comma expressions, and this seems

Re: DIP1001: DoExpression

2016-09-06 Thread Steven Schveighoffer via Digitalmars-d
On 9/6/16 10:17 AM, Timon Gehr wrote: On 06.09.2016 16:12, Steven Schveighoffer wrote: I'm not sure I agree with the general principal of the DIP though. I've never liked comma expressions, and this seems like a waste of syntax. Won't tuples suffice here when they take over the syntax? e.g.

Re: DIP1001: DoExpression

2016-09-06 Thread Timon Gehr via Digitalmars-d
On 06.09.2016 16:12, Steven Schveighoffer wrote: I'm not sure I agree with the general principal of the DIP though. I've never liked comma expressions, and this seems like a waste of syntax. Won't tuples suffice here when they take over the syntax? e.g. (x, y, z)[$-1] (Does not work if x, y

Re: DIP1001: DoExpression

2016-09-06 Thread Steven Schveighoffer via Digitalmars-d
On 9/3/16 12:03 PM, Jonathan M Davis via Digitalmars-d wrote: On Saturday, September 03, 2016 14:42:34 Cauterite via Digitalmars-d wrote: On Saturday, 3 September 2016 at 14:25:49 UTC, rikki cattermole wrote: I propose a slight change: do(x, y, return z) Hmm, I suppose I should mention one

Re: DIP1001: DoExpression

2016-09-03 Thread Timon Gehr via Digitalmars-d
On 03.09.2016 17:28, Andrei Alexandrescu wrote: What's wrong with: auto seq(T...)(auto ref T vals) { return vals[$ - 1]; } - The name (I'd expect that function to return vals). - Does not work if one or more arguments is of type 'void'. (Arguably that's just a language misdesign.)

Re: DIP1001: DoExpression

2016-09-03 Thread Andrei Alexandrescu via Digitalmars-d
On 9/3/16 6:39 PM, Cauterite wrote: On Saturday, 3 September 2016 at 16:28:15 UTC, Andrei Alexandrescu wrote: This is a terrible argument. It has "why not" all over it. -- Andrei Sorry, it's my first time proposing a language feature. My DConf 2016 talk has a few considerations on what

Re: DIP1001: DoExpression

2016-09-03 Thread Cauterite via Digitalmars-d
On Saturday, 3 September 2016 at 16:03:39 UTC, Jonathan M Davis wrote: So, instead of having the return statement which everyone knows to look for and is easy to grep for, you want to add a way to return _without_ a return statement? I think you've misunderstood. Even with DoExpressions, the

Re: DIP1001: DoExpression

2016-09-03 Thread Cauterite via Digitalmars-d
On Saturday, 3 September 2016 at 16:28:15 UTC, Andrei Alexandrescu wrote: This is a terrible argument. It has "why not" all over it. -- Andrei Sorry, it's my first time proposing a language feature.

Re: DIP1001: DoExpression

2016-09-03 Thread Cauterite via Digitalmars-d
On Saturday, 3 September 2016 at 16:10:16 UTC, Jonathan M Davis wrote: .. and from what I've seen, it seems to be the case that just about only the only folks who read it correctly are the ones who use it frequently .. You know what else is easy to misread? { x; y; return z; }();

Re: DIP1001: DoExpression

2016-09-03 Thread Andrei Alexandrescu via Digitalmars-d
On 9/3/16 6:19 PM, Cauterite wrote: On Saturday, 3 September 2016 at 15:28:36 UTC, Andrei Alexandrescu wrote: What's wrong with: auto seq(T...)(auto ref T vals) { return vals[$ - 1]; } Well there's nothing *wrong* with that, but I really think that 'do' is the perfect word for this purpose,

Re: DIP1001: DoExpression

2016-09-03 Thread Andrei Alexandrescu via Digitalmars-d
On 9/3/16 6:10 PM, Jonathan M Davis via Digitalmars-d wrote: I think that we're much better off just killing it off. We're better off with what we have right now: you can use comma, just don't take the last value. Absent a smoking gun (and one very smokey and stinky at that), I don't see

Re: DIP1001: DoExpression

2016-09-03 Thread Cauterite via Digitalmars-d
On Saturday, 3 September 2016 at 15:28:36 UTC, Andrei Alexandrescu wrote: What's wrong with: auto seq(T...)(auto ref T vals) { return vals[$ - 1]; } Well there's nothing *wrong* with that, but I really think that 'do' is the perfect word for this purpose, and the fact that it's already a

Re: DIP1001: DoExpression

2016-09-03 Thread Andrei Alexandrescu via Digitalmars-d
On 9/3/16 4:49 PM, Cauterite wrote: On Saturday, 3 September 2016 at 14:26:30 UTC, Stefan Koch wrote: Introducing an expression for this seems overkill. The same could be said for the '=>' lambda syntax. Doesn't do anything that {return x;} can't do. Lambdas are a matter of frequency. --

Re: DIP1001: DoExpression

2016-09-03 Thread Jonathan M Davis via Digitalmars-d
On Saturday, September 03, 2016 17:20:28 Dicebot via Digitalmars-d wrote: > DIP: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1001.md > > Abstract > > > A DoExpression do(x,y,z) is exactly equivalent to a CommaExpression > (x,y,z), but doesn't emit a deprecation warning. > >

Re: DIP1001: DoExpression

2016-09-03 Thread Jonathan M Davis via Digitalmars-d
On Saturday, September 03, 2016 14:42:34 Cauterite via Digitalmars-d wrote: > On Saturday, 3 September 2016 at 14:25:49 UTC, rikki cattermole > > wrote: > > I propose a slight change: > > do(x, y, return z) > > Hmm, I suppose I should mention one other motivation behind this > DIP: > > I really

Re: DIP1001: DoExpression

2016-09-03 Thread Andrei Alexandrescu via Digitalmars-d
On 9/3/16 4:26 PM, Stefan Koch wrote: The same can be already achieved using a function literal. Even better! -- Andrei

Re: DIP1001: DoExpression

2016-09-03 Thread Andrei Alexandrescu via Digitalmars-d
On 9/3/16 4:20 PM, Dicebot wrote: DIP: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1001.md Abstract A DoExpression do(x,y,z) is exactly equivalent to a CommaExpression (x,y,z), but doesn't emit a deprecation warning. == First

Re: DIP1001: DoExpression

2016-09-03 Thread Cauterite via Digitalmars-d
On Saturday, 3 September 2016 at 14:47:50 UTC, rikki cattermole wrote: I may dislike not using return but please consider at the very least using ; instead of , for the last element do(x, y ; z). Just something to hint that the last one is special. Not a bad idea, actually. I feel like the

Re: DIP1001: DoExpression

2016-09-03 Thread Cauterite via Digitalmars-d
On Saturday, 3 September 2016 at 14:26:30 UTC, Stefan Koch wrote: Introducing an expression for this seems overkill. The same could be said for the '=>' lambda syntax. Doesn't do anything that {return x;} can't do.

Re: DIP1001: DoExpression

2016-09-03 Thread rikki cattermole via Digitalmars-d
On 04/09/2016 2:42 AM, Cauterite wrote: On Saturday, 3 September 2016 at 14:25:49 UTC, rikki cattermole wrote: I propose a slight change: do(x, y, return z) Hmm, I suppose I should mention one other motivation behind this DIP: I really like to avoid using the 'return' keyword inside

Re: DIP1001: DoExpression

2016-09-03 Thread Cauterite via Digitalmars-d
On Saturday, 3 September 2016 at 14:25:49 UTC, rikki cattermole wrote: I propose a slight change: do(x, y, return z) Hmm, I suppose I should mention one other motivation behind this DIP: I really like to avoid using the 'return' keyword inside expressions, because I find it visually

Re: DIP1001: DoExpression

2016-09-03 Thread rikki cattermole via Digitalmars-d
On 04/09/2016 2:20 AM, Dicebot wrote: DIP: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1001.md Abstract A DoExpression do(x,y,z) is exactly equivalent to a CommaExpression (x,y,z), but doesn't emit a deprecation warning. == First

Re: DIP1001: DoExpression

2016-09-03 Thread Stefan Koch via Digitalmars-d
On Saturday, 3 September 2016 at 14:20:28 UTC, Dicebot wrote: DIP: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1001.md Abstract A DoExpression do(x,y,z) is exactly equivalent to a CommaExpression (x,y,z), but doesn't emit a deprecation warning.

DIP1001: DoExpression

2016-09-03 Thread Dicebot via Digitalmars-d-announce
http://forum.dlang.org/post/nqem7g$1hm6$1...@digitalmars.com signature.asc Description: OpenPGP digital signature

DIP1001: DoExpression

2016-09-03 Thread Dicebot via Digitalmars-d
DIP: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1001.md Abstract A DoExpression do(x,y,z) is exactly equivalent to a CommaExpression (x,y,z), but doesn't emit a deprecation warning. == First community DIP has just landed the review