Inferred Type for Explicit Cast

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 29 07:50:21 PST 2014


On 12/29/14 6:08 AM, Dicebot wrote:
> On Wednesday, 24 December 2014 at 03:11:40 UTC, Andrei Alexandrescu wrote:
>> On 12/20/14 6:47 PM, Steven Schveighoffer wrote:
>>> On 12/20/14 5:20 AM, Dicebot wrote:
>>>
>>>> I'd like to have a cast where you must define both "from" and "to"
>>>> types
>>>> precisely.
>>>
>>> I was actually thinking the same thing. This would be almost
>>> future-proof (any changes to either side would result in failed
>>> compilation).
>>>
>>> -Steve
>>
>> Specifying two types instead of one in a "to" call should achieve
>> that. -- Andrei
>
> This is different. `to` is about "smart" conversion (and potentially
> costly with allocations flying around) - we are speaking about same
> basic dumb cast here, just more controlled.

I see. I guess it's easy to add std.conv.explicitCast and 
std.conv.implicitCast if there's enough impetus for it. -- Andrei



More information about the Digitalmars-d mailing list