Jonathan Blow demo #2

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 11 08:57:33 PST 2014


Jonathan Blow, Programming Language Demo #2:

https://www.youtube.com/watch?v=-UPFH0eWHEI

https://www.reddit.com/r/programming/comments/2oyg5e/jonathan_blow_dec_10_programming_language_demo_2/

------------------

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);

------------------

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;

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.

------------------

He suggests something like a @noinline attribute.

Bye,
bearophile


More information about the Digitalmars-d mailing list