Opt-in for including argument names in ABI
Seb
seb at wilzba.ch
Thu Sep 17 17:31:44 UTC 2020
On Thursday, 17 September 2020 at 16:11:08 UTC, Alexandru
Ermicioi wrote:
> On Thursday, 17 September 2020 at 14:12:13 UTC, Seb wrote:
>> tl;dr: `pragma(mangle, withArgumentNames:true)` would be a way
>> to tell the compiler to include the argument names in the ABI,
>> s.t. overloads with different names can be resolved.
>>
>> Why?
>>
>> 1) Provide implementations for different input formats
>> ------------------------------------------------------
>>
>> ```
>> sin(deg: 90);
>> sin(rad: 0.5);
>> ```
>
> I think the example provided is not the best argument for this
> feature. The problem with it is that deg, and rad, should
> actually be distinctive types. Then you could implement those
> types to support following syntaxes such as 0.5 * rad or
> 0.5.rad, for convenience.
>
> Regards,
> Alex.
Yes, but the "feature" is really only intended to be useful for
smooth deprecation.
It is just a nice side effects that this works as well.
> The problem with it is that deg, and rad, should actually be
> distinctive types.
They aren't in the standard library.
Another example would be `wait(seconds: 5)` or `wait(minutes:
10)`. I'm aware that we have `dur`.
It's just that as deprecations require ABI mangling, it would
open up this feature.
If that's not popular, we don't need to allow it. I'm solely
interested in `deprecate` for argument names. So this could be
restricted to scopes with `deprecate` only.
More information about the Digitalmars-d
mailing list