On Wednesday, 27 June 2018 at 12:25:26 UTC, Uknown wrote:
On Wednesday, 27 June 2018 at 10:22:38 UTC, Vijay Nayar wrote:
Most of the documentation at
https://dlang.org/spec/declaration.html#alias uses examples of
the form: `alias aliasName = other;`, where `aliasName`
becomes the new name to reference `other`. Alternatively, one
may write `alias other aliasName;`. My understanding is that
the syntax with `=` is the preferred one stylistically.
However, when it comes to `alias this` declarations, the only
syntax supported is `alias other this;`, and one cannot write
`alias this = other;`.
Does this mean that the `alias other aliasName;` syntax is
preferred, or does it simply mean that this is a low priority
issue that hasn't been addressed yet?
`alias Alias = SomeType;` is preferred. It is the new style,
and is more clear on what is the alias and what is the new
type, especially when complex types come into play. For `alias
this` though, there is only one syntax, `alias other this;`,
since it does something conceptually different from regular
aliases.
aliasing a function type only works with the old syntax too:
alias void proto_identifier();
Very unfriendly syntax. Impossible to express with
AliasDeclarationY (aka "the new alias syntax").