`alias x = v.x;` not working in struct bodies?

FeepingCreature feepingcreature at gmail.com
Sun Jan 21 04:50:03 UTC 2024


On Saturday, 20 January 2024 at 22:41:30 UTC, Steven 
Schveighoffer wrote:
> On Saturday, 20 January 2024 at 22:25:35 UTC, Danilo wrote:
>> If you step back to see the bigger picture, it is very 
>> intuitive to write:
>> ```d
>> alias x = v.x;
>> alias y = this.v.y;
>> ```
>> It means giving an `alias name` to an entity, and I think it's 
>> not hard to understand that.
>> It's just logical in a broader sense, when you look at the 
>> bigger picture. ;)
>
> I agree that it's intuitive to do. It just doesn't do the thing 
> you are expecting. It's a code smell in D.
>
> I even filed an issue on it. 
> https://issues.dlang.org/show_bug.cgi?id=16123
>
> -Steve

Works in Neat, btw! :) You can even alias expressions.

For example, 
https://github.com/Neat-Lang/neat/blob/master/src/neat/base.nt#L747


More information about the Digitalmars-d mailing list