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

FeepingCreature feepingcreature at gmail.com
Sun Jan 21 13:18:07 UTC 2024


On Sunday, 21 January 2024 at 05:54:15 UTC, Basile B. wrote:
> Assuming Neat grammar is similar to D, things like
>
>     alias memberCall = member.call();
>
> would give, as used in the source code
>
>     context.memberCall;
>
> which is then lowered to
>
>     context.(member.call());
>
> while it should be
>
>     (context.member).call();
>
> So it's no only the unintentional capture problem here, it also 
> now about precedence. Unless you'be already aware of the 
> problem (or maybe you'd use your macro system ?) I have more 
> examples 
> [here](https://gitlab.com/styx-lang/styx/-/blob/master/src/styx/semantic/expressions.sx?ref_type=heads#L521).

I have a hard time understanding what problem you're describing, 
but it's probably fine? Expression aliases are evaluated in the 
context of the declaration site, not the call site. This doesn't 
involve the grammar at all.


More information about the Digitalmars-d mailing list