Jonathan Blow demo #2

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 11 13:34:13 PST 2014


On 12/11/2014 8:57 AM, bearophile wrote:
> He shows a way to not initialize a struct that has specified values. In D it
> could be:
>
> struct Vec { float x = 1, y = 5, z = 9; }
>
> auto v = new Vec(void);
> auto av = new Vec[10] = void;
> auto av2 = new Vec[10] = Vec(0, 0, 0);

D already does this. It's been said before, Jonathan is reinventing D, piece by 
piece :-)


> He suggests a way to optionally specify the type of array indexes. In a D-like
> syntax it could be:
>
> enum N = 10;
> float[N : ushort] a1;
> float[: ushort] a2;

I don't see any point to this.


> My point of having this in D is to optionally increase strictness of the array
> indexes, to avoid some bugs when you handle many arrays.

Doesn't make sense to me.


> He suggests something like a @noinline attribute.

It'll go into D in some form. It's an old suggestion.



More information about the Digitalmars-d mailing list