[GSoC Proposal] Statically Checked Measurement Units

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Mar 28 17:12:53 PDT 2011


On 3/28/11 6:09 PM, spir wrote:
> On 03/28/2011 10:13 PM, Cristi Cobzarenco wrote:
>> - The Categorical type sounds like a great idea. I think they could be
>> passed on as a ValueType to a quantity:
>> typedef Quantity!(City, BoundedInt!(0,100)) CityID;
>>
>> And BoundedInt is just a type implicitly-convertible to and from int,
>> that
>> supports assignment and equality and throws on an out-of-bounds
>> assignment.
>
> I would implement something like Categorical in a language that has no
> enum. But I do not see the point in D. What advantage does it bring?
>
> Denis

A categorical type may not have a name for each value (userid, cityid, 
countryid...)

Andrei


More information about the Digitalmars-d mailing list