www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Some questions now D2 is frozen

reply "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:
Andrei said in the 'D2 Closure' thread that D2 has officially been 
frozen, and that he and Walter has made a lot of desicions on their own 
over the past few weeks.

That makes me, and I'm sure others as well, curious as to what these 
desicions were, and what the final D2 spec looks like.  I'd hate to have 
to wait for TDPL to come out, and the compiler releases catching up, to 
find out. ;)

So, Walter, Andrei, and anyone else in the know:

1. Will array literals be immutable?

2. Have you found new names for the "ugly" keywords? (__gshared, __traits)

3. Have you found a "rule" for determining whether an attribute is a 
keyword or an  annotation?

4. Will private members inside eponymous templates work?

5. Will opIndex and opSlice be merged?

6. Do arrays still have the built-in 'reverse' and 'sort' properties?

7. Are there any changes that haven't been mentioned or discussed on the 
NG yet?


-Lars
Feb 18 2010
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Lars T. Kyllingstad wrote:
 Andrei said in the 'D2 Closure' thread that D2 has officially been 
 frozen, and that he and Walter has made a lot of desicions on their own 
 over the past few weeks.
 
 That makes me, and I'm sure others as well, curious as to what these 
 desicions were, and what the final D2 spec looks like.  I'd hate to have 
 to wait for TDPL to come out, and the compiler releases catching up, to 
 find out. ;)
 
 So, Walter, Andrei, and anyone else in the know:
 
 1. Will array literals be immutable?
No, but the compiler may take different decisions on allocation depending on usage.
 2. Have you found new names for the "ugly" keywords? (__gshared, __traits)
No, but we're not bound to those names. TDPL does not present the most obscure features.
 3. Have you found a "rule" for determining whether an attribute is a 
 keyword or an  annotation?
No.
 4. Will private members inside eponymous templates work?
Yes.
 5. Will opIndex and opSlice be merged?
No.
 6. Do arrays still have the built-in 'reverse' and 'sort' properties?
Should deprecate those.
 7. Are there any changes that haven't been mentioned or discussed on the 
 NG yet?
Don't think so. Andrei
Feb 18 2010
parent bearophile <bearophileHUGS lycos.com> writes:
Andrei Alexandrescu:
 2. Have you found new names for the "ugly" keywords? (__gshared, __traits)
No, but we're not bound to those names. TDPL does not present the most obscure features.
__traits is used often enough in generic code, and __gshared while not common is not obscure, it's not hard to understand. Bye, bearophile
Feb 18 2010
prev sibling next sibling parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Lars T. Kyllingstad wrote:
 Andrei said in the 'D2 Closure' thread that D2 has officially been 
 frozen, and that he and Walter has made a lot of desicions on their own 
 over the past few weeks.
 
 That makes me, and I'm sure others as well, curious as to what these 
 desicions were, and what the final D2 spec looks like.  I'd hate to have 
 to wait for TDPL to come out, and the compiler releases catching up, to 
 find out. ;)
Don't jump the gun, the community is still waiting for a final D1 spec! Stewart.
Feb 18 2010
prev sibling parent reply Philippe Sigaud <philippe.sigaud gmail.com> writes:
On Thu, Feb 18, 2010 at 09:28, Lars T. Kyllingstad
<public kyllingen.nospamnet> wrote:

 Andrei said in the 'D2 Closure' thread that D2 has officially been frozen,
 and that he and Walter has made a lot of desicions on their own over the
 past few weeks.

 That makes me, and I'm sure others as well, curious as to what these
 desicions were, and what the final D2 spec looks like.  I'd hate to have to
 wait for TDPL to come out, and the compiler releases catching up, to find
 out. ;)

 So, Walter, Andrei, and anyone else in the know:
 (...)
8. Universal function call syntax? If a.foo(b) doesn't compile, let's try foo(a,b), whatever the types of a and b. Currently, it works only for arrays. Philippe
Feb 18 2010
parent reply "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:
Philippe Sigaud wrote:
 On Thu, Feb 18, 2010 at 09:28, Lars T. Kyllingstad 
 <public kyllingen.nospamnet> wrote:
 
     Andrei said in the 'D2 Closure' thread that D2 has officially been
     frozen, and that he and Walter has made a lot of desicions on their
     own over the past few weeks.
 
     That makes me, and I'm sure others as well, curious as to what these
     desicions were, and what the final D2 spec looks like.  I'd hate to
     have to wait for TDPL to come out, and the compiler releases
     catching up, to find out. ;)
 
     So, Walter, Andrei, and anyone else in the know:
     (...)
 
 
 8. Universal function call syntax? If a.foo(b) doesn't compile, let's 
 try foo(a,b), whatever the types of a and b. Currently, it works only 
 for arrays.
Andrei said in an earlier thread that this is in the book -- hence, it's in the language. :) -Lars
Feb 18 2010
parent reply Jacob Carlborg <doob me.com> writes:
On 2/19/10 08:29, Lars T. Kyllingstad wrote:
 Philippe Sigaud wrote:
 On Thu, Feb 18, 2010 at 09:28, Lars T. Kyllingstad
 <public kyllingen.nospamnet> wrote:

 Andrei said in the 'D2 Closure' thread that D2 has officially been
 frozen, and that he and Walter has made a lot of desicions on their
 own over the past few weeks.

 That makes me, and I'm sure others as well, curious as to what these
 desicions were, and what the final D2 spec looks like. I'd hate to
 have to wait for TDPL to come out, and the compiler releases
 catching up, to find out. ;)

 So, Walter, Andrei, and anyone else in the know:
 (...)


 8. Universal function call syntax? If a.foo(b) doesn't compile, let's
 try foo(a,b), whatever the types of a and b. Currently, it works only
 for arrays.
Andrei said in an earlier thread that this is in the book -- hence, it's in the language. :) -Lars
It's not implemented yet.
Feb 19 2010
parent reply Philippe Sigaud <philippe.sigaud gmail.com> writes:
On Fri, Feb 19, 2010 at 13:51, Jacob Carlborg <doob me.com> wrote:
[Universal function call syntax]

 It's not implemented yet.
But do you know of it's on the plate for D2? Lars says it's in TDPL, so it must be on the todo list, hopefully. Well, I guess they all have too much to do right now, and as some recent new features are quite cool, I'm happy that way. Anyway, that would be a useful feature, particularly for generic code: you know some types have a method that you want to use, and you can add it to other types also with this mechanism. Another thing I'd be very happy to have is opImplicitCast.... Philippe
Feb 21 2010
next sibling parent reply Michel Fortin <michel.fortin michelf.com> writes:
On 2010-02-21 08:28:02 -0500, Philippe Sigaud <philippe.sigaud gmail.com> said:

 Another thing I'd be very happy to have is opImplicitCast....
I think this works already: alias opImplicitCast this; property T opImplicitCast() { ... } -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Feb 21 2010
parent reply Philippe Sigaud <philippe.sigaud gmail.com> writes:
On Sun, Feb 21, 2010 at 14:34, Michel Fortin <michel.fortin michelf.com>wrote:

 On 2010-02-21 08:28:02 -0500, Philippe Sigaud <philippe.sigaud gmail.com>
 said:

  Another thing I'd be very happy to have is opImplicitCast....

 I think this works already:

        alias opImplicitCast this;

         property T opImplicitCast() { ... } <http://michelf.com/>
Hmm, I'm still a bit leery of 'alias this' as all my uses for it misfired. But if that works, then, being an obnoxious brat, I will ask for the possibility to have many 'alias this' in the same object :-) Anyway, I just tried: class C { alias opImplicitCast this; property int opImplicitCast() { return 1;} } auto c = new C(); int foo(int a) { return a;} foo(c); // error. function main.foo (int a) is not callable using argument types (C) auto i = cast(int)c; // This works, but I'd call that explicit cast... I'm doing something wrong there? Is calling foo on c an implicit cast?
Feb 21 2010
parent Michel Fortin <michel.fortin michelf.com> writes:
On 2010-02-21 08:56:14 -0500, Philippe Sigaud <philippe.sigaud gmail.com> said:

 Anyway, I just tried:
 
 class C {
 
    alias opImplicitCast this;
 
     property int opImplicitCast() { return 1;}
 }
 
 auto c = new C();
 int foo(int a) { return a;}
 
 foo(c); // error. function main.foo (int a) is not callable using argument
 types (C)
 auto i = cast(int)c; // This works, but I'd call that explicit cast...
 
 I'm doing something wrong there? Is calling foo on c an implicit cast?
I was using this to implicitly convert to an Object. Seems it does not work for an int. -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Feb 21 2010
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2/21/10 14:28, Philippe Sigaud wrote:
 On Fri, Feb 19, 2010 at 13:51, Jacob Carlborg <doob me.com
 <mailto:doob me.com>> wrote:
 [Universal function call syntax]

     It's not implemented yet.


 But do you know of it's on the plate for D2? Lars says it's in TDPL, so
 it must be on the todo list, hopefully.
Andrei said it would be in D2 but then he also said it's already implemented, which it isn't. It's also easy to implement (at least for variables).
 Well, I guess they all have too much to do right now, and as some recent
 new features are quite cool, I'm happy that way.

 Anyway, that would be a useful feature, particularly for generic code:
 you know some types have a method that you want to use, and you can add
 it to other types also with this mechanism.


 Another thing I'd be very happy to have is opImplicitCast....

 Philippe
Feb 21 2010