On Wednesday, 23 October 2024 at 17:18:47 UTC, Anton Pastukhov
wrote:
On Wednesday, 23 October 2024 at 14:50:44 UTC, Paul Backus
wrote:
On Wednesday, 23 October 2024 at 12:46:24 UTC, Paul Backus
wrote:
You can't use an `alias` to refer to a member variable like
this. When you write
alias myAlias = myStruct.test;
...it is silently rewritten by the compiler to
alias myAlias = MyStruct.test;
So, in reality, there is no difference between the two
versions.
Is it intended behavior? Is it documented somewhere? I'm
looking here https://dlang.org/spec/declaration.html#alias and
it states: "An AliasDeclaration creates a symbol name that
refers to a type or another symbol". `myStruct.test` is a
symbol.
Its intended and probably the right decision, but good luck
finding relivent docs.
id suggest passing `a=>a.test` to whatever function instead of
trying to control the alias formally