Feedback on Átila's Vision for D

Paul Backus snarwin at gmail.com
Wed Oct 16 18:27:21 UTC 2019


On Wednesday, 16 October 2019 at 18:15:45 UTC, Sebastiaan Koppe 
wrote:
>> C++'s partial ordering for concepts is able to correctly 
>> determine that the second overload is more specialized than 
>> the first. Your proposed solution that only examines the 
>> symbols is not.
>
> Yes it would. But maybe I am not explaining myself well enough. 
> If you were to substitute the symbols and literally count the 
> boolean operators, the fun's would get 1 and 3 respectively. 
> That is what I meant with ast+lookup. Sorry for being so brief.

In that case, your algorithm will give false positives, which I 
consider grounds for disqualification. For example:

auto fun(T)(T arg) if (isA!T) { ... }
auto fun(T)(T arg) if (isA!T && isA!T) { ... }

Currently, these overloads are (correctly) considered ambiguous. 
If we go by symbol counts, however, the second overload would be 
preferred.

> This is a very alpha idea and far from a solution, it is just 
> that I don't believe it can't be done.

Obviously it can be done: C++ already does it. The question is 
not *whether* the problem can be solved, but *which* of several 
possible solutions is the best fit for D.


More information about the Digitalmars-d mailing list