Interesting rant about Scala's issues
Simen Kjærås
simen.kjaras at gmail.com
Fri Apr 4 18:51:48 PDT 2014
On 2014-04-04 04:31, Walter Bright wrote:
> On 4/3/2014 7:19 PM, bearophile wrote:
>> I have asked for fully typesafe enums in D,
>
> You can do this:
>
> struct MyInt {
> int x;
> alias this x;
> ... put your various constraints here ...
> }
>
> to get typesafe enums. In fact, you can use this construct to create a
> type that overrides selected behaviors of any other type.
For a more complete implementation of typesafe enums, here's my take:
https://github.com/Biotronic/Collectanea/blob/master/biotronic/enumeration.d
--
Simen
More information about the Digitalmars-d-announce
mailing list