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

Steven Schveighoffer schveiguy at gmail.com
Sat Jan 20 22:41:30 UTC 2024


On Saturday, 20 January 2024 at 22:25:35 UTC, Danilo wrote:
> Thanks Steven! Of course you all are able to concentrate on the
> details of how it is implemented, because you work on that 
> level every day.
>
> 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


More information about the Digitalmars-d mailing list