Re: Jonathan Blow demo #2

2014-12-22 Thread Andrei Alexandrescu via Digitalmars-d
On 12/12/14 2:47 AM, bearophile wrote: OK, I think that it will be enough to add a Phobos function like this (what's the right Phobos module to put it?) (why isn't this @trusted?) (why isn't this returning a T*?): ref T uninitializedAlloc(T)() @system pure nothrow { return

Re: Jonathan Blow demo #2

2014-12-12 Thread bearophile via Digitalmars-d
Walter Bright: On 12/11/2014 1:49 PM, bearophile wrote: Walter Bright: 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. D doesn't do that, not even one of those three :-) I beg

Re: Jonathan Blow demo #2

2014-12-12 Thread bearophile via Digitalmars-d
Walter Bright: I don't see support for the notion of a ushort index. A ushort index is not useful, I agree. That's why I have said my proposal is a little different from Jonathan Blow idea. My point was to optionally define built-in arrays with a strongly typed indexing (where the

Re: Jonathan Blow demo #2

2014-12-12 Thread Martin Nowak via Digitalmars-d
On 12/12/2014 10:54 AM, bearophile wrote: This code: struct Vec { float x = 1, y = 5, z = 9; } auto v = new Vec(void); Means having defined a struct with explicitly statically defined fields, and then allocate one of it on the heap without initializing its fields. It's equivalent to: auto v =

Re: Jonathan Blow demo #2

2014-12-12 Thread bearophile via Digitalmars-d
Martin Nowak: OK, I think that it will be enough to add a Phobos function like this (what's the right Phobos module to put it?) (why isn't this @trusted?) (why isn't this returning a T*?): ref T uninitializedAlloc(T)() @system pure nothrow { return *cast(T*)GC.malloc(T.sizeof); }

Re: Jonathan Blow demo #2

2014-12-12 Thread bearophile via Digitalmars-d
OK, I think that it will be enough to add a Phobos function like this (what's the right Phobos module to put it?) (why isn't this @trusted?) (why isn't this returning a T*?): ref T uninitializedAlloc(T)() @system pure nothrow { return *cast(T*)GC.malloc(T.sizeof); }

Re: Jonathan Blow demo #2

2014-12-12 Thread Martin Nowak via Digitalmars-d
On 12/12/2014 11:42 AM, bearophile wrote: Martin Nowak: OK, I think that it will be enough to add a Phobos function like this (what's the right Phobos module to put it?) Did you just volunteer to make a pull :)? As usual, having a problem to find the right place myself. Would put it close to

Re: Jonathan Blow demo #2

2014-12-12 Thread Martin Nowak via Digitalmars-d
On 12/11/2014 10:34 PM, Walter Bright wrote: D already does this. It's been said before, Jonathan is reinventing D, piece by piece :-) What does that mean, it's been said? Didn't anyone actually try to tell him about D?

Re: Jonathan Blow demo #2

2014-12-12 Thread Tobias Pankrath via Digitalmars-d
On Friday, 12 December 2014 at 11:58:04 UTC, Martin Nowak wrote: On 12/11/2014 10:34 PM, Walter Bright wrote: D already does this. It's been said before, Jonathan is reinventing D, piece by piece :-) What does that mean, it's been said? Didn't anyone actually try to tell him about D?

Re: Jonathan Blow demo #2

2014-12-12 Thread Chris via Digitalmars-d
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

Re: Jonathan Blow demo #2

2014-12-12 Thread Martin Nowak via Digitalmars-d
On 12/12/2014 01:15 PM, Tobias Pankrath wrote: Actually he dismisses D in his first video for being too much like C++. What do you usually do when learning a new programming language? Right, write a small program. Apparently he ruled out all 3 candidates by looking at the front page of their

Re: Jonathan Blow demo #2

2014-12-12 Thread Joakim via Digitalmars-d
On Friday, 12 December 2014 at 11:58:04 UTC, Martin Nowak wrote: On 12/11/2014 10:34 PM, Walter Bright wrote: D already does this. It's been said before, Jonathan is reinventing D, piece by piece :-) What does that mean, it's been said? He means he said it before: :)

Re: Jonathan Blow demo #2

2014-12-12 Thread ponce via Digitalmars-d
On Friday, 12 December 2014 at 11:58:04 UTC, Martin Nowak wrote: On 12/11/2014 10:34 PM, Walter Bright wrote: D already does this. It's been said before, Jonathan is reinventing D, piece by piece :-) What does that mean, it's been said? Didn't anyone actually try to tell him about D? I

Re: Jonathan Blow demo #2

2014-12-12 Thread Walter Bright via Digitalmars-d
On 12/12/2014 1:58 AM, bearophile wrote: My point was to optionally define built-in arrays with a strongly typed indexing (where the strongly typed index can be defined with a better version of Typedef!()), as I've tried to explain in that post. All you have to do is define your own array type

Re: Jonathan Blow demo #2

2014-12-12 Thread Walter Bright via Digitalmars-d
On 12/12/2014 3:57 AM, Martin Nowak wrote: On 12/11/2014 10:34 PM, Walter Bright wrote: D already does this. It's been said before, Jonathan is reinventing D, piece by piece :-) What does that mean, it's been said? Didn't anyone actually try to tell him about D? I've emailed him about it.

Jonathan Blow demo #2

2014-12-11 Thread bearophile via Digitalmars-d
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

Re: Jonathan Blow demo #2

2014-12-11 Thread Walter Bright via Digitalmars-d
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

Re: Jonathan Blow demo #2

2014-12-11 Thread bearophile via Digitalmars-d
Walter Bright: 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. D doesn't do that, not even one of those three :-) I'm willing to open one or two ERs later on those things. At best

Re: Jonathan Blow demo #2

2014-12-11 Thread bearophile via Digitalmars-d
Walter Bright: 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. D doesn't do that, not even one of those three :-) I'm willing to open one or two ERs later on those things. At best

Re: Jonathan Blow demo #2

2014-12-11 Thread Walter Bright via Digitalmars-d
On 12/11/2014 1:49 PM, bearophile wrote: 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

Re: Jonathan Blow demo #2

2014-12-11 Thread Walter Bright via Digitalmars-d
On 12/11/2014 1:49 PM, bearophile wrote: Walter Bright: 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. D doesn't do that, not even one of those three :-) I beg to differ: