Preferred Alias Declaration Style

Basile B. b2.temp at gmx.com
Wed Jun 27 17:31:22 UTC 2018


On Wednesday, 27 June 2018 at 15:27:09 UTC, Steven Schveighoffer 
wrote:
> On 6/27/18 6:22 AM, Vijay Nayar wrote:
>> Does this mean that the `alias other aliasName;` syntax is 
>> preferred, or does it simply mean that this is a low priority 
>> issue that hasn't been addressed yet?
>
> IIRC, there was an ambiguity for using the new syntax for alias 
> this. I don't remember the thread where it was discussed, but 
> you are not the first to bring it up.
>
> -Steve

The ambiguity is that `this` resolves to a type in aggregates:

```
class Foo
{
     alias FooToo = this;
     static assert(is(FooToo == Foo));
}
```

Fortunately this is being removed from the language see:

https://github.com/dlang/dmd/commit/524a924477fa02bc2ff11de085f93ab657377d0a



More information about the Digitalmars-d-learn mailing list