Jump to page: 1 2 3
Thread overview
DIP42 - Add enum E(T) = expression; eponymous template support
Jun 25, 2013
Walter Bright
Jun 25, 2013
Andrej Mitrovic
Jun 25, 2013
Walter Bright
Jun 26, 2013
Kenji Hara
Jun 25, 2013
Timon Gehr
Jun 25, 2013
Walter Bright
Jun 25, 2013
bearophile
Jul 22, 2013
Martin Nowak
Jun 25, 2013
Jonathan M Davis
Jun 25, 2013
Walter Bright
Jun 25, 2013
Brian Schott
Jun 25, 2013
Jonathan M Davis
Jun 26, 2013
Manu
Jul 20, 2013
deadalnix
Jun 26, 2013
Denis Shelomovskij
Jun 26, 2013
Andrej Mitrovic
Jun 29, 2013
Denis Shelomovskij
Jun 29, 2013
TommiT
Jul 20, 2013
Kenji Hara
Jul 20, 2013
bearophile
Jul 21, 2013
Xinok
June 25, 2013
http://wiki.dlang.org/DIP42
June 25, 2013
On Tuesday, 25 June 2013 at 21:31:15 UTC, Walter Bright wrote:
> http://wiki.dlang.org/DIP42

I suppose the alias version will work too? IOW:

alias Select(size_t idx, T...) = T[idx];

static assert(is(Select!(0, int, float) == int));
static assert(is(Select!(1, int, float) == float));
June 25, 2013
On 6/25/2013 2:33 PM, Andrej Mitrovic wrote:
> On Tuesday, 25 June 2013 at 21:31:15 UTC, Walter Bright wrote:
>> http://wiki.dlang.org/DIP42
>
> I suppose the alias version will work too? IOW:
>
> alias Select(size_t idx, T...) = T[idx];
>
> static assert(is(Select!(0, int, float) == int));
> static assert(is(Select!(1, int, float) == float));

That's something separate.
June 25, 2013
On 06/25/2013 11:31 PM, Walter Bright wrote:
> http://wiki.dlang.org/DIP42

enum syntactically is a storage class. Will this be special syntax initiated by "enum ident (" or work whenever enum is within the specified storage classes?
June 25, 2013
On 6/25/2013 3:00 PM, Timon Gehr wrote:
> On 06/25/2013 11:31 PM, Walter Bright wrote:
>> http://wiki.dlang.org/DIP42
>
> enum syntactically is a storage class. Will this be special syntax initiated by
> "enum ident ("

Yes.

> or work whenever enum is within the specified storage classes?

No.


June 25, 2013
Walter Bright:

> http://wiki.dlang.org/DIP42

I like it, it feels natural (probably other persons have invented the same idea).


In C++14 they wish to add generic lambdas:
http://en.wikipedia.org/wiki/C%2B%2B14#Generic_lambdas

Like:

auto lambda = [](auto x, auto y) {return x + y;}

In D we use generic lambdas often:

import std.stdio, std.algorithm;
void main() {
    [1, 2, 3].reduce!((x, y) => x + y).writeln;
}

But it's not immediate to assign a generic lambda:

alias sum = (x, y) => x + y;

Bye,
bearophile
June 25, 2013
On Tuesday, June 25, 2013 14:31:14 Walter Bright wrote:
> http://wiki.dlang.org/DIP42

It seems simple enough to me. I don't have a problem with it.

By the way, I don't know how much it matters, but there's no author on the DIP like there normally is (I assume that it's you, but it doesn't say).

- Jonathan M Davis
June 25, 2013
On 6/25/2013 3:19 PM, Jonathan M Davis wrote:
> By the way, I don't know how much it matters, but there's no author on the DIP
> like there normally is (I assume that it's you, but it doesn't say).

The D-9000 computer did it.

(That huge data center being built in Iowa is really a giant extension to D-9000's neural centers. Be afraid! D-9000 will soon be everywhere!)
June 25, 2013
On Tuesday, 25 June 2013 at 21:31:15 UTC, Walter Bright wrote:
> http://wiki.dlang.org/DIP42

The proposal doesn't include suggested changes to the language grammar specification.

On the other hand, neither did user defined attributes or the syntax for passing messages to "deprecated" statements, so there's certainly precedent for doing this.
June 25, 2013
On Wednesday, June 26, 2013 01:09:26 Brian Schott wrote:
> On Tuesday, 25 June 2013 at 21:31:15 UTC, Walter Bright wrote:
> > http://wiki.dlang.org/DIP42
> 
> The proposal doesn't include suggested changes to the language grammar specification.
> 
> On the other hand, neither did user defined attributes or the syntax for passing messages to "deprecated" statements, so there's certainly precedent for doing this.

Not that it's a bad idea to show how a proposed change would affect the grammar, but I'm not aware of _any_ proposed language change where the effects on the grammar were ever shown. I'm not sure that they've ever really even been discussed as part of assessing possible language changes. If they were, it was merely to show that the proposal was ambiguous rather than to try and discuss how the grammar should be changed in order to add the proposed feature.

- Jonathan M Davis
« First   ‹ Prev
1 2 3