View mode: basic / threaded / horizontal-split · Log in · Help
February 18, 2010
Some questions now D2 is frozen
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
February 18, 2010
Re: Some questions now D2 is frozen
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
February 18, 2010
Re: Some questions now D2 is frozen
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.
February 18, 2010
Re: Some questions now D2 is frozen
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
February 18, 2010
Re: Some questions now D2 is frozen
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
February 19, 2010
Re: Some questions now D2 is frozen
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
February 19, 2010
Re: Some questions now D2 is frozen
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.
February 21, 2010
Re: Some questions now D2 is frozen
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
February 21, 2010
Re: Some questions now D2 is frozen
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/
February 21, 2010
Re: Some questions now D2 is frozen
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?
« First   ‹ Prev
1 2
Top | Discussion index | About this forum | D home