News for hackers. Stuff that matters.
Re:Python's sad, unimaginative Enum by tomp on Saturday May 11, 2013 @01:53PM (#5691390)
But sometimes you only need enums (which are, arguably, a subcategory of ADTs). E.g. playing card suits, true/false, ...
Re:Python's sad, unimaginative Enum by tikhonj on Saturday May 11, 2013 @05:18PM (#5692130)
Not just arguably--that's exactly what they are. E.g., in Haskell:

    data Suit = Spades
              | Hearts
              | Clubs
              | Diamonds deriving (Show, Eq, Bounded, Enum)
this creates a type that acts exactly like an enum. With the added benefit of having a well-defined string representation and maxBound/minBound constants for free.
Re:Python's sad, unimaginative Enum by gnaritas on Sunday May 12, 2013 @07:00PM (#5696240)
True and false work fine as singleton subclasses of the abstract class Boolean; see Smalltalk.
Re:Python's sad, unimaginative Enum by tomp on Tuesday May 14, 2013 @09:52AM (#5704786)
What prevents me from making a third subclass, Undetermined?

ADTs and enums are meant to prevent this.

Re:Python's sad, unimaginative Enum by gnaritas on Tuesday May 14, 2013 @02:54PM (#5707160)
> What prevents me from making a third subclass, Undetermined?

Smalltalk isn't about preventing things, it's about enabling them.