Re: Lambda syntax, etc

2009-02-09 Thread Bartosz Milewski
bearophile Wrote: Now, back to the topic: putting arguments into a single () or {} instead of a (){ return ;} (or with the = of C#) helps the eye see a single visual object isntead of two, this helps the human parsing of the code, improving visual chunking and reducing noise. I also

Re: escaping addresses of ref parameters - not

2009-02-09 Thread Bartosz Milewski
My point is that it's a redundant check. Whether it is there or not, the result is the same--the program will halt. Maybe the error message form enforce will look nicer, but that's about it. Brad Roberts Wrote: Bartosz Milewski wrote: Of course, enforce(mdgt); is there only for

Re: Old problem with performance

2009-02-09 Thread Kagamin
Weed Wrote: The code on C++ is also approximately in 6 times faster a code with classes on D. (I do not give an example on C++ because classes on C++ work just as structures in D.) class C { int i; real[5] unused; // to prevent returning this object in registers C opAdd( C

Re: Lambda syntax, etc

2009-02-09 Thread Kagamin
Denis Koroskin Wrote: Could be used as follows: foo( (i) { ++i; } ); Holy shi- Now feel some real power, Luke. :) foo( i = ++i ); foo((i){ ++i; }); // error foo((i){ ++i; return;}); // unambiguous foo((i){ return ++i;}); // unambiguous

Re: Lambda syntax, etc

2009-02-09 Thread Denis Koroskin
On Mon, 09 Feb 2009 13:24:46 +0300, Kagamin s...@here.lot wrote: Denis Koroskin Wrote: Could be used as follows: foo( (i) { ++i; } ); Holy shi- Now feel some real power, Luke. :) foo( i = ++i ); foo((i){ ++i; }); // error foo((i){ ++i; return;}); // unambiguous foo((i){

Re: (non)nullable types

2009-02-09 Thread Alex Burton
I vote yes. I was pretty sure the topic was refering to the ability to specify a pointer that could not be set to 0. I totally agree with this rule, and enforce it in all my C++ code with smart pointers. class X { }; X x; //in D or X * x; //in C++ Setting x to zero or any other value that

Re: (non)nullable types

2009-02-09 Thread bearophile
Jason House: Non-nullable types should be implicitly castable to nullable types when making function calls that don't support them. An explicit cast may be better/safer. Bye, bearophile

Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Alex Burton
I think it makes no sense to have nullable pointers in a high level language like D. In D : X x = new X; This is a bit redundant, if we take away the ability to write X x; to mean X x = 0; then we can have X x; mean X x = new X; If the class has a ctor then we can write X x(32); instead of X x

Re: (non)nullable types

2009-02-09 Thread bearophile
Alex Burton: ( actually why don't I start a new thread about this) I suggest you to start a new thread (and to try to explain yourself a bit better). Bye, bearophile

Re: Lambda syntax, etc

2009-02-09 Thread Kagamin
Denis Koroskin Wrote: That was just an example. Those short lambdas are often used as predicates. Compare: findAll(array, (i) { i 3; }); findAll(array, (int i) { return i 3; }); well... you pwnd me :)

Re: Old problem with performance

2009-02-09 Thread Kagamin
Weed Wrote: Well, D class code here is not equivalent to C++ class code. D code has more features, namely, it's polymorphic: C.opAdd is able to work with classes, derived from C, while corresponding C++ code is unable to do so. It is really true? Of course. There opAdd is only for

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Denis Koroskin
On Mon, 09 Feb 2009 13:48:39 +0300, Alex Burton alex...@mac.com wrote: I think it makes no sense to have nullable pointers in a high level language like D. In D : X x = new X; This is a bit redundant, if we take away the ability to write X x; to mean X x = 0; then we can have X x; mean X

Re: (non)nullable types

2009-02-09 Thread Michel Fortin
On 2009-02-08 23:19:55 -0500, Brian digitalm...@brianguertin.com said: On Mon, 09 Feb 2009 04:25:55 +0300, Denis Koroskin wrote: So, let's ask the community: Would you like to see nullable types in D? http://www.micropoll.com/akira/mpview/539369-138652 (please, don't abuse by voting multiple

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Ary Borenszweig
Alex Burton wrote: I think it makes no sense to have nullable pointers in a high level language like D. In D : X x = new X; This is a bit redundant, if we take away the ability to write X x; to mean X x = 0; then we can have X x; mean X x = new X; If the class has a ctor then we can write X

Re: Old problem with performance

2009-02-09 Thread Michel Fortin
On 2009-02-08 23:43:13 -0500, Weed resume...@mail.ru said: Michel Fortin пишет: On 2009-02-08 09:30:08 -0500, Weed resume...@mail.ru said: Let's assume, polymorphism is necessary to these objects Polymorphism doesn't work very well while passing objects by value, even in C++. This is

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Michel Fortin
On 2009-02-09 06:41:59 -0500, Ary Borenszweig a...@esperanto.org.ar said: How would you do this? X x; if(someCondition) { x = new SomeX(); } else { x = new SomeOtherX(); } Well, the declaration could be transformed to this: X x = new X; But since x is not used before being

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Don
Ary Borenszweig wrote: Alex Burton wrote: I think it makes no sense to have nullable pointers in a high level language like D. In D : X x = new X; This is a bit redundant, if we take away the ability to write X x; to mean X x = 0; then we can have X x; mean X x = new X; If the class has a

Re: Old problem with performance

2009-02-09 Thread Michel Fortin
On 2009-02-09 07:00:56 -0500, Weed resume...@mail.ru said: No. By forbiding the cases that leads to slicing, like returning a polymorphic object by value. Let's think, can there are other ways to solve problem? Here, for example my reasons:

Re: Old problem with performance

2009-02-09 Thread Kagamin
Weed Wrote: Well, D class code here is not equivalent to C++ class code. D code has more features, namely, it's polymorphic: C.opAdd is able to work with classes, derived from C, while corresponding C++ code is unable to do so. But I do not understand in what here problem. In C++ is

Re: Old problem with performance

2009-02-09 Thread Christopher Wright
Rainer Deyke wrote: Andrei Alexandrescu wrote: The slicing problem exists in spades in this example, or better put its converse (your code will fire asserts when it shouldn't). The reason is rather subtle, so please try the code out to edify yourself. You're referring to the automatically

Re: escaping addresses of ref parameters - not

2009-02-09 Thread Christopher Wright
Daniel Keep wrote: I've used ref arguments in the past to wrap a C api that expects pointers. I'm fine with this so long as there is a way to break out of it (in regular D, at least) that makes it abundantly clear you need to know what you're doing. Something like: void wrapSomeCApi(ref Foo

Re: escaping addresses of ref parameters - not

2009-02-09 Thread Christopher Wright
Denis Koroskin wrote: On Mon, 09 Feb 2009 11:24:09 +0300, Bartosz Milewski bart...@relisoft.com wrote: My point is that it's a redundant check. Whether it is there or not, the result is the same--the program will halt. Maybe the error message form enforce will look nicer, but that's about

Re: (non)nullable types

2009-02-09 Thread Christopher Wright
Brian wrote: On Mon, 09 Feb 2009 04:25:55 +0300, Denis Koroskin wrote: So, let's ask the community: Would you like to see nullable types in D? http://www.micropoll.com/akira/mpview/539369-138652 (please, don't abuse by voting multiple time) Explain your reasoning in newsgroups. Thank you.

Re: (non)nullable types

2009-02-09 Thread Christopher Wright
Brian wrote: On Mon, 09 Feb 2009 04:25:55 +0300, Denis Koroskin wrote: So, let's ask the community: Would you like to see nullable types in D? http://www.micropoll.com/akira/mpview/539369-138652 (please, don't abuse by voting multiple time) Explain your reasoning in newsgroups. Thank you.

Re: Old problem with performance

2009-02-09 Thread Don
Michel Fortin wrote: On 2009-02-09 07:00:56 -0500, Weed resume...@mail.ru said: No. By forbiding the cases that leads to slicing, like returning a polymorphic object by value. Let's think, can there are other ways to solve problem? Here, for example my reasons:

Re: escaping addresses of ref parameters - not

2009-02-09 Thread Denis Koroskin
Christopher Wright Wrote: Daniel Keep wrote: I've used ref arguments in the past to wrap a C api that expects pointers. I'm fine with this so long as there is a way to break out of it (in regular D, at least) that makes it abundantly clear you need to know what you're doing.

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Christopher Wright
Michel Fortin wrote: On 2009-02-09 06:41:59 -0500, Ary Borenszweig a...@esperanto.org.ar said: How would you do this? X x; if(someCondition) { x = new SomeX(); } else { x = new SomeOtherX(); } Well, the declaration could be transformed to this: X x = new X; But since x is not

Re: Old problem with performance

2009-02-09 Thread Christopher Wright
Weed wrote: And if I need some different such combinations? For each it is necessary to write such 8-10 lines? This is terrible! You need to add those lines for every method you need virtual dispatch with for your value type. It's an overhead of three lines per method, two for the interface

Re: Lambda syntax, etc

2009-02-09 Thread Christopher Wright
Kagamin wrote: Christopher Wright Wrote: D: void foo(void delegate(int) dg); C#: delegate void SomeName(int i); void foo(SomeName dg); Does C# 3 fix this? I've seen the new syntax for defining delegates, but not for using them. C# got anough rope for this :)

Re: Old problem with performance

2009-02-09 Thread bearophile
Kagamin: Well, D class code here is not equivalent to C++ class code. D code has more features, namely, it's polymorphic: C.opAdd is able to work with classes, derived from C, while corresponding C++ code is unable to do so. If you can't use polymorphism, why do you use classes? I'd like to

Re: Old problem with performance

2009-02-09 Thread Weed
Michel Fortin пишет: On 2009-02-09 07:00:56 -0500, Weed resume...@mail.ru said: No. By forbiding the cases that leads to slicing, like returning a polymorphic object by value. Let's think, can there are other ways to solve problem? Here, for example my reasons:

Re: Old problem with performance

2009-02-09 Thread Weed
Christopher Wright пишет: Weed wrote: And if I need some different such combinations? For each it is necessary to write such 8-10 lines? This is terrible! You need to add those lines for every method you need virtual dispatch with for your value type. It's an overhead of three lines per

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Daniel Keep
Ary Borenszweig wrote: How would you do this? X x; if(someCondition) { x = new SomeX(); } else { x = new SomeOtherX(); } One option is the turn everything into an expression route. This is what Nemerle (think a functional superset of C#) did, and it's just BEAUTIFULLY

Re: Lambda syntax, etc

2009-02-09 Thread Jarrett Billingsley
On Mon, Feb 9, 2009 at 3:19 AM, Bartosz Milewski bart...@relisoft.com wrote: bearophile Wrote: Now, back to the topic: putting arguments into a single () or {} instead of a (){ return ;} (or with the = of C#) helps the eye see a single visual object isntead of two, this helps the human

Re: Old problem with performance

2009-02-09 Thread Yigal Chripun
Weed wrote: Christopher Wright пишет: Weed wrote: And if I need some different such combinations? For each it is necessary to write such 8-10 lines? This is terrible! You need to add those lines for every method you need virtual dispatch with for your value type. It's an overhead of three

Re: escaping addresses of ref parameters - not

2009-02-09 Thread Daniel Keep
Denis Koroskin wrote: Christopher Wright Wrote: Daniel Keep wrote: I've used ref arguments in the past to wrap a C api that expects pointers. I'm fine with this so long as there is a way to break out of it (in regular D, at least) that makes it abundantly clear you need to know what

Re: Lambda syntax, etc

2009-02-09 Thread bearophile
Jarrett Billingsley: auto r = find!(\a - a.Weight 100)(range); [...] something(\a, b { stmt1; stmt2; }); This looks better to me (but I don't know if this is the best syntax, it's just an idea): // syntax for lambda that contains a single expression, implicit return (this is

Re: Lambda syntax, etc

2009-02-09 Thread grauzone
// syntax for lambda that contains a single expression, implicit return (this is the most common case): auto r = find!(a = a.Weight 100)(range); I really like this one, but I'd prefer something like auto r = find(range, {a - a.Weight 100}); Note the - instead of the =, to avoid any

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread grauzone
Alex Burton wrote: I think it makes no sense to have nullable pointers in a high level language like D. In D : X x = new X; This is a bit redundant, if we take away the ability to write X x; to mean X x = 0; then we can have X x; mean X x = new X; If the class has a ctor then we can write X

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Frits van Bommel
Daniel Keep wrote: One option is the turn everything into an expression route. This is what Nemerle (think a functional superset of C#) did, and it's just BEAUTIFULLY expressive. X x = if( someCondition ) new SomeX(); else new SomeOtherX(); Failing that, there's always this (note: didn't do

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Denis Koroskin
Christopher Wright Wrote: Michel Fortin wrote: On 2009-02-09 06:41:59 -0500, Ary Borenszweig a...@esperanto.org.ar said: How would you do this? X x; if(someCondition) { x = new SomeX(); } else { x = new SomeOtherX(); } Well, the declaration could be transformed

Re: Lambda syntax, etc

2009-02-09 Thread bearophile
grauzone Wrote: I really like this one, but I'd prefer something like auto r = find(range, {a - a.Weight 100}); Note the - instead of the =, to avoid any ambiguities with the comparison operator. Let's play more; then what do you think about (all the following are legal): auto r1 =

Re: Lambda syntax, etc

2009-02-09 Thread bearophile
bearophile: auto r1 = range.find((ArrayType1!(typeof(range)) x) { return x.weight 100; }); Better: auto r1 = range.find((BaseType1!(typeof(range)) x) { return x.weight 100; }); Of course, you have to specify range twice there, and that's not good. Bye, bearophile

Re: Lambda syntax, etc

2009-02-09 Thread grauzone
bearophile wrote: grauzone Wrote: I really like this one, but I'd prefer something like auto r = find(range, {a - a.Weight 100}); Note the - instead of the =, to avoid any ambiguities with the comparison operator. Let's play more; then what do you think about (all the following are

Re: goto

2009-02-09 Thread Steven Schveighoffer
Walter Bright wrote Don wrote: The irony is that's Walter's the biggest goto advocate I know, other than Linus Torvalds. I don't mind being compared to Linus g. If you like, I can name several not-so-spectacular coders that I know who like to use goto ;) -Steve

Re: Old problem with performance

2009-02-09 Thread Andrei Alexandrescu
Rainer Deyke wrote: Andrei Alexandrescu wrote: The slicing problem exists in spades in this example, or better put its converse (your code will fire asserts when it shouldn't). The reason is rather subtle, so please try the code out to edify yourself. You're referring to the automatically

Re: escaping addresses of ref parameters - not

2009-02-09 Thread Andrei Alexandrescu
Daniel Keep wrote: I've used ref arguments in the past to wrap a C api that expects pointers. I'm fine with this so long as there is a way to break out of it (in regular D, at least) that makes it abundantly clear you need to know what you're doing. Something like: void wrapSomeCApi(ref Foo

Re: (non)nullable types

2009-02-09 Thread Andrei Alexandrescu
bearophile wrote: Jason House: Non-nullable types should be implicitly castable to nullable types when making function calls that don't support them. An explicit cast may be better/safer. Non-nullable types are proper subtypes of nullable types. There is no added safety in requiring a

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Andrei Alexandrescu
Denis Koroskin wrote: On Mon, 09 Feb 2009 13:48:39 +0300, Alex Burton alex...@mac.com wrote: I think it makes no sense to have nullable pointers in a high level language like D. In D : X x = new X; This is a bit redundant, if we take away the ability to write X x; to mean X x = 0; then we

Re: escaping addresses of ref parameters - not

2009-02-09 Thread Jason House
Andrei Alexandrescu Wrote: Jason House wrote: What constitutes escaping? The callee tucks away the address of the ref parameter, or the address of a direct field of it. Ok, so this is head-escape analysis instead of transitive escape analysis. Still, there are a few issues that I can

Re: escaping addresses of ref parameters - not

2009-02-09 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: Andrei Alexandrescu wrote The compiler's escape detection mechanism can't help quite a lot here because the escape hatch is rather indirect. Initially I thought SafeD should prevent such escapes, whereas D allows them. Now I start thinking the pattern above is

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Daniel Keep
Frits van Bommel wrote: Daniel Keep wrote: One option is the turn everything into an expression route. This is what Nemerle (think a functional superset of C#) did, and it's just BEAUTIFULLY expressive. X x = if( someCondition ) new SomeX(); else new SomeOtherX(); Failing that, there's

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Denis Koroskin
Andrei Alexandrescu Wrote: Denis Koroskin wrote: On Mon, 09 Feb 2009 13:48:39 +0300, Alex Burton alex...@mac.com wrote: I think it makes no sense to have nullable pointers in a high level language like D. In D : X x = new X; This is a bit redundant, if we take away the

Re: (non)nullable types

2009-02-09 Thread bearophile
Andrei Alexandrescu: Non-nullable types are proper subtypes of nullable types. There is no added safety in requiring a cast. Yes, sorry, often I misunderstood (I was thinking of the opposite situation). Bye, bearophile

Re: (non)nullable types

2009-02-09 Thread Brian
On Mon, 09 Feb 2009 04:19:55 +, Brian wrote: On Mon, 09 Feb 2009 04:25:55 +0300, Denis Koroskin wrote: So, let's ask the community: Would you like to see nullable types in D? http://www.micropoll.com/akira/mpview/539369-138652 (please, don't abuse by voting multiple time) Explain

Re: (non)nullable types

2009-02-09 Thread Sebastian Biallas
Christopher Wright wrote: Oh, and I vote no. I think it's needless complexity. I code without any special care for null objects, and I get a segfault or NullReferenceException maybe once a week, probably less. I've always been able to track down the bug very quickly. That misses the point

Re: (non)nullable types

2009-02-09 Thread Brian
On Mon, 09 Feb 2009 18:20:56 +, Brian wrote: well, at the very least id like to see a (optional) warning/error for uninitialized pointers. This way I can be certain there are absolutely zero null pointers unless the null keyword itself is used. A quick search for 'null' would be guaranteed

Re: escaping addresses of ref parameters - not

2009-02-09 Thread Bartosz Milewski
What bothers me is that this is equivalent to saying that a seg fault caused by null dereference can be caught only if the programmer puts explicit runtime checks before it happens. I would say that reaks of C philosophy, except that in most C++ implementation I've been working with you can

Re: Old problem with performance

2009-02-09 Thread Denis Koroskin
On Mon, 09 Feb 2009 15:53:59 +0300, Don nos...@nospam.com wrote: Michel Fortin wrote: On 2009-02-09 07:00:56 -0500, Weed resume...@mail.ru said: No. By forbiding the cases that leads to slicing, like returning a polymorphic object by value. Let's think, can there are other ways to solve

Re: Old problem with performance

2009-02-09 Thread Rainer Deyke
Andrei Alexandrescu wrote: So the problem exists since you are trusting the programmer to avoid it. The slicing problem exists in the sense that it is possible for a bad programmer to accidentally slice an object. However: - This is not a problem with the language, but an avoidable programmer

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Alex Burton
Ary Borenszweig Wrote: Alex Burton wrote: I think it makes no sense to have nullable pointers in a high level language like D. In D : X x = new X; This is a bit redundant, if we take away the ability to write X x; to mean X x = 0; then we can have X x; mean X x = new X; If

OT: How to initialize *non-null reference* lazily? WAS: Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Denis Koroskin
On Mon, 09 Feb 2009 14:41:59 +0300, Ary Borenszweig a...@esperanto.org.ar wrote: [skip] How would you do this? X x; if(someCondition) { x = new SomeX(); } else { x = new SomeOtherX(); } Note: I am not talking about an X x(42); shortcut now, see the subject. This is a good question,

Re: Old problem with performance

2009-02-09 Thread Michel Fortin
On 2009-02-09 16:02:10 -0500, Denis Koroskin 2kor...@gmail.com said: The one case I could think of was the strategy pattern: no data is added (including, no virtual functions) -- the only thing that's added is a different implementation of an existing virtual function. In such a situation,

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Daniel Keep
Denis Koroskin wrote: Andrei Alexandrescu Wrote: Denis Koroskin wrote: On Mon, 09 Feb 2009 13:48:39 +0300, Alex Burton alex...@mac.com wrote: I think it makes no sense to have nullable pointers in a high level language like D. In D : X x = new X; This is a bit redundant, if we take

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Alex Burton
Daniel Keep Wrote: Alex Burton wrote: Daniel Keep Wrote: Alex Burton wrote: I think it makes no sense to have nullable pointers in a high level language like D. Oh, and how do you intend to make linked lists? Or trees? Or any non-trivial data structure? I am not

Structs implementing interfaces in D1

2009-02-09 Thread Tom S
/** Just a simple hack to have interfaces implemented by structs ... because I can :P Tested on DMD 1.039 [win32], GDC (various versions) [linux32] and codepad.org Output: Entering main Foo.func1 called ; val1 = 3.141590, val2 = Hello, world! Foo.func2 called ; val1 = 3.141590, val2 = Hello,

Re: Structs implementing interfaces in D1

2009-02-09 Thread Tom S
Chad J wrote: Hawt! I take it this can be done without assembly? Should be doable, but with more pain and overhead (the generated functions would need to pass all parameters to the real ones and you'd have to take care of ref-ness). -- Tomasz Stachowiak http://h3.team0xf.com/ h3/h3r3tic

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Andrei Alexandrescu
Daniel Keep wrote: Denis Koroskin wrote: Andrei Alexandrescu Wrote: Denis Koroskin wrote: On Mon, 09 Feb 2009 13:48:39 +0300, Alex Burton alex...@mac.com wrote: I think it makes no sense to have nullable pointers in a high level language like D. In D : X x = new X; This is a bit

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread dsimcha
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article Daniel Keep wrote: Denis Koroskin wrote: Andrei Alexandrescu Wrote: Denis Koroskin wrote: On Mon, 09 Feb 2009 13:48:39 +0300, Alex Burton alex...@mac.com wrote: I think it makes no sense to have nullable

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Andrei Alexandrescu
dsimcha wrote: == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article Sure. My suggested framework is one in which you'd use malloc for those allocations. Then you can free. But plopping delete in the midst of a GC system... that's just uncalled for. Andrei But then, you

Re: Structs implementing interfaces in D1

2009-02-09 Thread Tom S
BCS wrote: Hello Tom, The concept is pretty simple. The mixin creates a vtable which points to a set of generated functions of the form { adjust the 'this' ptr; jump to the real function; }. Finally, the InterfaceName asInterfaceName() functions generated inside the struct return pointers to

Re: Structs implementing interfaces in D1

2009-02-09 Thread BCS
Hello Tom, BCS wrote: Hello Tom, The concept is pretty simple. The mixin creates a vtable which points to a set of generated functions of the form { adjust the 'this' ptr; jump to the real function; }. Finally, the InterfaceName asInterfaceName() functions generated inside the struct return

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Chad J
Besides safety concerns, what does forbidding manual deletion enable GC implementations to do?

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Andrei Alexandrescu
Chad J wrote: Besides safety concerns, what does forbidding manual deletion enable GC implementations to do? Foregoing delete affords the GC more implementation options. Andrei

Re: Structs implementing interfaces in D1

2009-02-09 Thread Tom S
BCS wrote: Hello Tom, BCS wrote: Hello Tom, The concept is pretty simple. The mixin creates a vtable which points to a set of generated functions of the form { adjust the 'this' ptr; jump to the real function; }. Finally, the InterfaceName asInterfaceName() functions generated inside the

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Chad J
Andrei Alexandrescu wrote: Chad J wrote: Besides safety concerns, what does forbidding manual deletion enable GC implementations to do? Foregoing delete affords the GC more implementation options. Andrei Such as? I'm not trying to be antagonistic--manual deletion is a nifty feature to

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Nick Sabalausky
Daniel Keep daniel.keep.li...@gmail.com wrote in message news:gmpd71$8u...@digitalmars.com... Alex Burton wrote: I think it makes no sense to have nullable pointers in a high level language like D. Oh, and how do you intend to make linked lists? Or trees? Or any non-trivial data

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Nick Sabalausky
grauzone n...@example.net wrote in message news:gmpe6g$ad...@digitalmars.com... Alex Burton wrote: For structs, use opCall() to initialize them. opCall is the best way to initialize a struct, because struct literal are totally utterly useless. If you use opCall to initialize classes as

Re: Proposal : allocations made easier with non nullable types.

2009-02-09 Thread Nick Sabalausky
Alex Burton alex...@mac.com wrote in message news:gmqrec$2va...@digitalmars.com... I would propose that library writers have to use the X * x pointer notation to do their null pointer low level library implementation stuff, and the rest of us use X x which becomes more difficult (not

Re: Applying storage to type tuples

2009-02-09 Thread Burton Radons
Daniel Keep Wrote: Burton Radons wrote: I'm writing a couple of modules for dealing with database values (well really it's just storage of aggregates) in a native fashion from within D, using D 2.023. I have a tuple called FieldTypes which contains the D-side types. I'm trying to