Refined types [almost OT]

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Sun Oct 12 13:58:57 PDT 2014


On 10/12/2014 09:41 PM, Meta wrote:
> On Sunday, 12 October 2014 at 19:36:35 UTC, bearophile wrote:
>> Meta:
>>
>>> On Sunday, 12 October 2014 at 16:21:50 UTC, bearophile wrote:
>>> What happens if one of these conditions fails? Is an exception thrown?
>>
>> If you are using refined types, and D is somewhat assuming they are
>> refinements of those types, and one of those condition fails, then you
>> surely have a compile-time type error, because those conditions are an
>> intrinsic part of those type definition.
>>
>> Bye,
>> bearophile
>
> It's not possible to issue a compile-time error for runtime arguments,
> though,

Yes it is. Why wouldn't it be? Values needn't be completely determined 
in order to be reasoned about.

> and it can already be done in D using template constraints for
> compile-time arguments.



More information about the Digitalmars-d mailing list