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

Basile B. b2.temp at gmx.com
Sun Jan 21 05:54:15 UTC 2024


On Sunday, 21 January 2024 at 04:50:03 UTC, FeepingCreature wrote:
> Works in Neat, btw! :) You can even alias expressions.
>
> For example, 
> https://github.com/Neat-Lang/neat/blob/master/src/neat/base.nt#L747

Expressions aliases have a lot of problems when postfixes are 
involved.

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).


More information about the Digitalmars-d mailing list