The worst overload system that actualy works
Basile B.
b2.temp at gmx.com
Mon Dec 21 20:57:18 UTC 2020
On Monday, 21 December 2020 at 19:36:22 UTC, sighoya wrote:
> On Monday, 21 December 2020 at 13:35:10 UTC, Basile B. wrote:
>> Overloads can be confusing because of implict conversions and
>> promotion rules.
>> So here are the explicit overloads[1]. Note that there is no
>> plan to propose this for D ;)... destroy.
>>
>> [1] https://styx-lang.gitlab.io/styx/overload_declaration.html
>
> But they need anyway overload resolution for this.
Yes but it's simple. If Indentifier resolution gives an overload
set then the set members are tried, e.g O(n).
https://gitlab.com/styx-lang/styx/-/blob/master/src/styx/semantic/expressions.d#L395
>
> The advantage is that method could be assigned to more than one
> overloaded set (multi method).
>
> The disadvantage is the manual disambiguation of method names
> by defining their types.
> That sucks and they can't always be demangled in meaningful way
> than simply enumerating their param types.
>
> I find explicit implicit converions in D useful, but I didn't
> appreciate how overload resolution handles this that much.
More information about the Digitalmars-d
mailing list