std.sumtype?

Meta jared771 at gmail.com
Mon Mar 22 23:01:46 UTC 2021


On Monday, 22 March 2021 at 19:24:54 UTC, JN wrote:
> On Thursday, 18 March 2021 at 14:42:03 UTC, Oleg B wrote:
>> Hello everyone.
>>
>> Went to see what is being prepared in the new compiler and saw 
>> this
>> https://dlang.org/changelog/pending.html#std-sumtype
>
> Does anyone know if it would be possible to make it support (it 
> doesn't support it now) this kind of syntax:
>
> Temperature t1 = Fahrenheit(98.6);
> isFahrenheit(t1); // works
> isFahrenheit(Fahrenheit(98.6)); // doesn't work :(

I would love this too, but Walter is very against implicit 
conversions. IMO this is one of the major reasons that algebraic 
types as a library are not adequate compared to a built-in 
language feature in D.


More information about the Digitalmars-d mailing list