std.v2020.algorithm etc[ WAS: Is run.d going to be expand for runtime and the phobos library?]

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jun 23 05:26:21 UTC 2020


On 6/22/20 11:22 PM, Mathias LANG wrote:
> On Monday, 22 June 2020 at 21:46:51 UTC, Andrei Alexandrescu wrote:
>> On 6/22/20 12:50 PM, Paul Backus wrote:
>>
>>> IMHO the principled way to allow user-defined implicit conversions 
>>> is...to allow user-defined implicit conversions. But iirc that's a 
>>> can of worms Walter prefers not to open.
>>
>> What happens upon function calls is not an implicit conversion. It's a 
>> forced type change.
> 
> Can you expand on this ? I've never heard of this before.

https://run.dlang.io/is/KgeosK

Yah it's kinda surprising innit. For regular functions it's business as 
usual - exact match is attempted, conversions are considered etc. 
const(T[]) is convertible to const(T)[], nothing new about that.

For template functions however, although templates always do exact 
match, arrays surreptitiously change their type from const(T[]) to 
const(T)[], without a conversion in sight.

We need to offer that chance to other ranges if we want them to enjoy a 
similar treatment.


More information about the Digitalmars-d mailing list