On Monday, 3 November 2014 at 20:06:27 UTC, Marc Schütz wrote:
On Monday, 3 November 2014 at 15:39:42 UTC, IgorStepanov wrote:
I meant that when you say that X is a subtype of T and X is a
subtype of V where you don't know what T and V are, it means
you don't really know what you're doing. And that is an error
and the compiler should inform you about it as soon as
possible. However I may be mistaken.
IMO the behaviour should be analogous to name lookup for
modules: there should be an error only on use. It's hard to
come up with a non-artificial example, but I can imagine there
are some valid use cases in generic code. It won't hurt to
report the ambiguity error on use, while it could theoretically
hurt to report it early, so I'd suggest to go with the former.
There are two cases:
1: when "alias a this" tries to override base class typeof(a)
2: when "alias a this" tries to override "alias b this" where
"is(typeof(a) == typeof(b))"
The first check is hard to implement at lookup-time, because base
classes are resolved before alias this.
The second check may be easely dropped (anyway alias this
conflicts are resolved properly at lookup time).
Do you accept this scheme (remove the second check but still
alive the first check)?