On Thursday, 11 December 2014 at 16:57:35 UTC, bearophile wrote:
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
It would be nice, if you gave a real world example and explained
why you need this feature and whether the problem is general
enough to turn it into a feature of the language.
I sometimes think "Wouldn't it be nice to have feature X now!"
only to find out it is already there. This, or I realize the code
is flawed somewhere else and I can sort it out by fixing the
flawed code.
I'm sometimes tempted to demand a feature, but then I realize
that the problem is so specific that it would be ridiculous to
demand a language feature for a problem that is specific only to
my problem. It reminds me of laws. At the beginning laws cover
general cases (theft, fraud whatever), then people demand a
specific law for theft after 5 o'clock in winter when the moon is
full as opposed to theft in summer when the sky is blue. And
there was this guy who got robbed in autumn ...