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

Alex Rønne Petersen xtzgzorex at gmail.com
Sun Apr 1 20:41:00 PDT 2012


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...

-- 
- Alex


More information about the Digitalmars-d-learn mailing list