Tristate - wanna?
sarn via Digitalmars-d
digitalmars-d at puremagic.com
Sun Mar 27 19:55:28 PDT 2016
On Saturday, 26 March 2016 at 22:39:58 UTC, Alex Parrill wrote:
> On Saturday, 26 March 2016 at 22:11:53 UTC, Nordlöw wrote:
>> I can think of many variants of for this. What about
>>
>> { yes, // 1 chance
>> no, // 0 chance
>> likely, // > 1/2 chance
>> unlikely, // < 1/2 chance
>> unknown // any chance
>> }
>>
>> ?
>
> If we're going down that route, might as well use state tables.
> With CTFE + templates, you could possibly do something like
> this:
>
>
> immutable State[] StateOrTable = ParseStateTable!q{
> | yes | no | likely | unlikely | unknown
> ------------------------------------------------------
> yes | yes | yes | yes | yes | yes
> no | yes | no | likely | unlikely | unknown
> likely | yes | likely | likely | likely | likely
> unlikely| yes | unlikely | likely | unlikely | unknown
> unknown | yes | unknown | likely | unknwon | unknown
> };
I just hope we don't end up with an abomination like Microsoft's
MsoTriState:
https://msdn.microsoft.com/en-us/library/office/ff860737.aspx
(A "tristate boolean" with five values, three of which are "not
supported".)
More information about the Digitalmars-d
mailing list