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 next sibling parent reply Philippe Sigaud <philippe.sigaud gmail.com> writes:
--001517477f86253114047fe68b05
Content-Type: text/plain; charset=ISO-8859-1

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 --001517477f86253114047fe68b05 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote">On Thu, Feb 18, 2010 at 09:28, Lars T. Kyllingst= ad <span dir=3D"ltr">&lt;public kyllingen.nospamnet&gt;</span> wrote:<br><b= lockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-= left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> Andrei said in the &#39;D2 Closure&#39; thread that D2 has officially been = frozen, and that he and Walter has made a lot of desicions on their own ove= r the past few weeks.<br> <br> That makes me, and I&#39;m sure others as well, curious as to what these de= sicions were, and what the final D2 spec looks like. =A0I&#39;d hate to hav= e to wait for TDPL to come out, and the compiler releases catching up, to f= ind out. ;)<br> <br> So, Walter, Andrei, and anyone else in the know:<br>(...)<br></blockquote><= div><br>8. Universal function call syntax? If a.foo(b) doesn&#39;t compile,= let&#39;s try foo(a,b), whatever the types of a and b. Currently, it works= only for arrays.<br> <br><br>Philippe<br></div></div> --001517477f86253114047fe68b05--
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
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 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
prev sibling next sibling parent Philippe Sigaud <philippe.sigaud gmail.com> writes:
--00032555ac063b239b04801c4967
Content-Type: text/plain; charset=ISO-8859-1

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 --00032555ac063b239b04801c4967 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <br><br><div class=3D"gmail_quote">On Fri, Feb 19, 2010 at 13:51, Jacob Car= lborg <span dir=3D"ltr">&lt;<a href=3D"mailto:doob me.com">doob me.com</a>&= gt;</span> wrote:<br>[Universal function call syntax]<br><blockquote class= =3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid= rgb(204, 204, 204); padding-left: 1ex;"> It&#39;s not implemented yet.<br></blockquote><div><br>But do you know of i= t&#39;s on the plate for D2? Lars says it&#39;s in TDPL, so it must be on t= he todo list, hopefully.<br></div></div><br>Well, I guess they all have too= much to do right now, and as some recent new features are quite cool, I&#3= 9;m happy that way. <br> <br>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.<br><br><br>Another thing I&#39;d b= e very happy to have is opImplicitCast....<br> <br>Philippe<br><br> --00032555ac063b239b04801c4967--
Feb 21 2010
prev sibling parent Philippe Sigaud <philippe.sigaud gmail.com> writes:
--0015173fe87e1687f204801cae16
Content-Type: text/plain; charset=ISO-8859-1

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? --0015173fe87e1687f204801cae16 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <br><br><div class=3D"gmail_quote">On Sun, Feb 21, 2010 at 14:34, Michel Fo= rtin <span dir=3D"ltr">&lt;<a href=3D"mailto:michel.fortin michelf.com">mic= hel.fortin michelf.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_= quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, = 204, 204); padding-left: 1ex;"> <div class=3D"im">On 2010-02-21 08:28:02 -0500, Philippe Sigaud &lt;<a href= =3D"mailto:philippe.sigaud gmail.com" target=3D"_blank">philippe.sigaud gma= il.com</a>&gt; said:<br> <br> <blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde= r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> Another thing I&#39;d be very happy to have is opImplicitCast....<br> </blockquote> <br></div> I think this works already:<br> <br> =A0 =A0 =A0 =A0alias opImplicitCast this;<br> =A0 =A0 =A0 =A0<br> =A0 =A0 =A0 =A0 property T opImplicitCast() { ... }<font color=3D"#888888"=
<a href=3D"http://michelf.com/" target=3D"_blank"></a></font></blockquote>=

ses for it misfired. But if that works, then, being an obnoxious brat, I wi= ll ask for the possibility to have many &#39;alias this&#39; in the same ob= ject :-)<br> <br>Anyway, I just tried:<br><br>class C {<br><br> =A0=A0 alias opImplicitC= ast this;<br> =A0 =A0 =A0 =A0<br> =A0=A0 property int opImplicitCast() { return 1;}<br>}<br><br>auto c =3D = new C();<br>int foo(int a) { return a;}<br><br>foo(c); // error. function m= ain.foo (int a) is not callable using argument types (C)<br>auto i =3D cast= (int)c; // This works, but I&#39;d call that explicit cast...<br> <br>I&#39;m doing something wrong there? Is calling foo on c an implicit ca= st?<br></div></div><br> --0015173fe87e1687f204801cae16--
Feb 21 2010