Enhanced Enums -- use cases

Remi Forax forax at univ-mlv.fr
Fri Apr 28 18:43:42 UTC 2017


I will not say domething negative about the frankenum in the mail, wait, doh :)

[..]

>> What is annoying about the current implementations is the ceremony of
>> setting up per instance data.
> 
> Good point.  This interacts nicely with the planned "data class"
> feature; seems likely we can dish some of those goodies to enums at the
> same time.

Yes, C#, Scala, Ceylon, Kotlin all have a notion of principal/primary constructor, like this

  public enum Status(int exitCode) {
    BAD_USAGE(64),
    BAD_OR_MISSING_DATA(65),
    GENERAL_ERROR(70),
    VALIDATION_FAIL(75)
  }


regards,
Rémi


More information about the amber-dev mailing list