On Sunday, 22 July 2018 at 12:13:43 UTC, Anonymouse wrote:
Can this be made a compiler warning?
struct Foo
{
int i;
}
void main()
{
Foo foo;
with (foo)
{
i = 42;
int i;
i = 24;
}
}
I'm hesitant to file a bug because it'll just be immediately
closed with a link to
https://dlang.org/spec/statement.html#WithStatement. I
understand that's how it works, but it's weird and weak to
human mistakes.
Do you have an actual case where it was a problem, as opposed to
a contrived example with semantically empty identifiers? I
recently saw another comment objecting to `with` altogether as
being obfuscating because you can't tell which symbols are
qualified by the symbol in the with clause, when the obfuscation
was clearly due to the meaningless names in the poster's example.