std.typecons.Ref(T).opImplicitCastTo()

Alex Rønne Petersen xtzgzorex at gmail.com
Sun Apr 1 22:23:23 PDT 2012


On 02-04-2012 06:25, Jonathan M Davis wrote:
> On Monday, April 02, 2012 05:41:00 Alex Rønne Petersen wrote:
>> On 30-03-2012 19:28, Jonathan M Davis wrote:
>>> On Friday, March 30, 2012 16:27:44 simendsjo wrote:
>>>> Is opImplicitCastTo a planned feature?
>>>> It's only used in this type as I can see, and it doesn't add implicit
>>>> casting.
>>>
>>> It's been discussed, but I don't think that it's ever been agreed upon. In
>>> theory, alias this is meant to deal with implicit casts. I don't know whay
>>> anything in Phobos would have such a function. And I don't know what the
>>> point of std.typecons.Ref really is. It's undocumented (and clearly is
>>> _intended_ to be undocumented given what the comment is started with). I
>>> suspect that it's an old idea that just hasn't been cleaned out. If
>>> you'll notice, it also has opDot, which is being removed from the
>>> language.
>>>
>>> - Jonathan M Davis
>>
>> But you can only have one alias this per type. It is outright
>> incompatible with the idea of implicit cast operators. It's like
>> restricting opCast to only one overload per function - a
>> not-very-pragmatic decision if you ask me...
>
> alias this is not supposed to be restricted such that you can only have one
> per type. That's a temporary, implementation problem. TDPL specifically talks
> about having multiple alias thises per type.
>
> - Jonathan M Davis

What is the reason it hasn't been realized yet?

-- 
- Alex


More information about the Digitalmars-d-learn mailing list