DIP66 v1.1 (Multiple) alias this.

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Dec 26 12:37:18 PST 2014


On 12/23/2014 10:17 PM, Andrei Alexandrescu wrote:
> On 12/23/14 8:54 PM, Walter Bright wrote:
>>
>> The current behavior of:
>>
>>      is (D : B)
>>
>> is the expression will evaluate to false if D does not compile. However,
>> a compile time error will be issued if B does not compile.
>>
>> If D and B compile, then it will evaluate to false if B is not
>> implicitly convertible to D. This suggests to me Option 1, i.e. if the
>> implicit conversion fails due to ambiguity errors, then it should return
>> false (not issue a compile time error).
>
> Though I agree it makes sense to just return false, I think it would be more
> sensible and useful to issue an error. If B is reachable from B through multiple
> paths, that's a new situation distinct from yes/no.

That would be inconsistent with how 'is' works for other types.


> In fact a better thought: as soon as D is defined, repeated subtyping should be
> detected as an error. Then there's no question about "is" in the first place :o).

That's a good idea, but I think it is unworkable. What is the set of types that 
B is implicitly convertible too? It's unbounded.



More information about the Digitalmars-d mailing list