scala Enum

@viktorklang さんのtweetのリンク先のgist https://gist.github.com/1057513 のコメント上に、有名なScalaist 達が色々書いてるのでそれも読むべきたと思われ
0
Jorge Ortiz @JorgeO

When I started at foursquare >1yr ago, I tried to get us off scala.Enumeration. Failure to do so coming back to bite me: http://t.co/y1pTtXQ

2011-07-29 07:56:39
Kushal Dave @krave

@jorgeortiz85 What are we supposed to be using instead?

2011-07-29 16:43:27
Jorge Ortiz @JorgeO

@krave Unclear. My preference is for sealed traits and case objects, but there's no feature parity (you get no "enumeration" of the values).

2011-07-29 22:39:29
Jorge Ortiz @JorgeO

@krave I've heard some people just use Java Enums and keep those in .java source files. That would probably be the easiest/stablest bet.

2011-07-29 22:40:11
Oliver Stewart @sintactic

@jorgeortiz85 @djspiewak is there a good alternative to Enumeration, or do you roll your own?

2011-07-29 22:45:46
Jorge Ortiz @JorgeO

@sintactic @djspiewak No. My preference is sealed traits and case objects, but that lacks a key feature (an enumeration of the values).

2011-07-29 22:52:44
Daniel Spiewak @djspiewak

@jorgeortiz85 @sintactic See @viktorklang. You can get the best of both worlds by adding values to a Vector in the trait constructor.

2011-07-29 23:38:53