Thread overview
alias have new syntax?
Jan 18, 2014
cmplx
Jan 18, 2014
cmplx
Jan 18, 2014
Xinok
Jan 18, 2014
bearophile
Jan 18, 2014
Brian Schott
Jan 18, 2014
bearophile
Jan 18, 2014
Brian Schott
Jan 19, 2014
bearophile
Jan 19, 2014
Nicolas Sicard
January 18, 2014
During the study D, I stumbled upon this design
alias myInt = int;
but the specification says nothing about such use alias. Is the syntax has been changed?
January 18, 2014
On Saturday, 18 January 2014 at 22:50:50 UTC, cmplx wrote:
> During the study D, I stumbled upon this design
> alias myInt = int;
> but the specification says nothing about such use alias. Is the syntax has been changed?

Sorry, I wrong :
AliasDeclaration:
    ....
    alias AliasInitializerList

AliasInitializer:
    Identifier = Type
January 18, 2014
On Saturday, 18 January 2014 at 22:50:50 UTC, cmplx wrote:
> During the study D, I stumbled upon this design
> alias myInt = int;
> but the specification says nothing about such use alias. Is the syntax has been changed?

It seems that it's documented here, albeit not clearly:
http://dlang.org/declaration.html#AliasInitializer

I don't see any mention of it here:
http://dlang.org/declaration.html#alias

I recall there being some issues with alias this = identifier, not sure if that's been resolved. Regardless, I think the documentation at the latter link needs to be updated.
January 18, 2014
cmplx:

> During the study D, I stumbled upon this design
> alias myInt = int;
> but the specification says nothing about such use alias. Is the syntax has been changed?

Yes, it's a recent very small syntax improvement. Eventually I hope the older syntax will be deprecated. The old syntax is still used for the "static this" in structs.

Bye,
bearophile
January 18, 2014
On Saturday, 18 January 2014 at 23:00:11 UTC, bearophile wrote:
> Yes, it's a recent very small syntax improvement. Eventually I hope the older syntax will be deprecated. The old syntax is still used for the "static this" in structs.
>
> Bye,
> bearophile

DScanner now issues a warning when run with the --styleCheck or --syntaxCheck options suggesting that the user switch from "alias a b" to "alias b = a".

It also warns on implicit string concatenation, which has saved me a lot of debugging in situations like this:

enum someStrings = ["abc", "def" "ghi", "jkl"];
January 18, 2014
Brian Schott:

> It also warns on implicit string concatenation, which has saved me a lot of debugging in situations like this:
>
> enum someStrings = ["abc", "def" "ghi", "jkl"];

This should be an error in the language. Please add your experience (and vote, if you want) to this thread:
http://d.puremagic.com/issues/show_bug.cgi?id=3827

Bye,
bearophile
January 18, 2014
On Saturday, 18 January 2014 at 23:13:41 UTC, bearophile wrote:
> This should be an error in the language. Please add your experience (and vote, if you want) to this thread:
> http://d.puremagic.com/issues/show_bug.cgi?id=3827

I've added my vote.
January 19, 2014
Brian Schott:

> I've added my vote.

A note about your experience is probably more important than the vote.

You can add some bugs you have had to debug, some comment about the frequency of this problem, etc.

Bye,
bearophile
January 19, 2014
On Saturday, 18 January 2014 at 23:00:11 UTC, bearophile wrote:
> cmplx:
>
>> During the study D, I stumbled upon this design
>> alias myInt = int;
>> but the specification says nothing about such use alias. Is the syntax has been changed?
>
> Yes, it's a recent very small syntax improvement. Eventually I hope the older syntax will be deprecated. The old syntax is still used for the "static this" in structs.
>
> Bye,
> bearophile

You meant "alias this".