TypeFunction example creatiing a conversion matrix
Iain Buclaw
ibuclaw at gdcproject.org
Fri Oct 2 09:57:18 UTC 2020
On Thursday, 1 October 2020 at 18:26:48 UTC, H. S. Teoh wrote:
> On Thu, Oct 01, 2020 at 02:08:11PM -0400, Steven Schveighoffer
> via Digitalmars-d wrote:
>> On 10/1/20 1:35 PM, Andrei Alexandrescu wrote:
> [...]
>> > How do you implement Variant.get(T) without reifying is(T :
>> > U)?
>>
>> How do you implement Variant.get(T) *with* reifying is(U : T)?
>>
>> step 1: determine using reified constructs that U is
>> convertible to T
>> step 2: ?????
>> step 3: Return a T from a U!
>>
>> BTW, Variant already does a *limited* form of this.
>> reification doesn't change what needs to happen.
>>
>> I don't see why Variant's needs have to dictate how you need
>> to reason about types at compile time in CTFE.
> [...]
>
> I think what Andrei is getting at is, we want to be able to
> transfer the compiler's knowledge and implementation of
> implicit type conversions to runtime. I.e., we'd like to do
> this:
>
The compiler's knowledge of implicit conversions is a table that
hasn't changed since 2010. Why can't you just have a form of
this table in Phobos?
More information about the Digitalmars-d
mailing list