mixin template silently `override` without even a warning message!

Mike Parker aldacron at gmail.com
Sun Oct 9 07:24:13 UTC 2022


On Sunday, 9 October 2022 at 07:10:57 UTC, mw wrote:


>
> Has this problem be discussed before? and what's the conclusion?

This is documented behavior:

> The declarations in a mixin are placed in a nested scope and 
> then ‘imported’ into the surrounding scope. If the name of a 
> declaration in a mixin is the same as a declaration in the 
> surrounding scope, the surrounding declaration overrides the 
> mixin one:

And then:

> If a mixin has an Identifier, it can be used to disambiguate 
> between conflicting symbols:

https://dlang.org/spec/template-mixin.html#mixin_scope




More information about the Digitalmars-d mailing list