Smalltalkで列挙型(enum)
予想通りだった。
Enumeration type implementation - Squeak Smalltalk Beginners:
EpcimCurrency class
instanceVariableNames: 'enums'
EpcimCurrency class >> validate: aString
enums ifNil: [ self initialize ].
^ enums includesKey: aString.
EpcimCurrency class >> enums "for displaying in pulldown menus"
enums ifNil: [ self initialize ].
^enums copy
EpcimCurrency class >> initalize
(enums := Dictionary new)
add: 'USD'-> 'US dollar' ;
add: 'EUR'-> 'European euro' ;
add: 'AUD'-> 'Australian dollar' ;
add: 'CAD'-> 'Canadian dollar' ;
add: 'CHF'-> 'Swiss francs' ;
add: 'CNY'-> 'Chinese yuan renminbi' ;
add: 'DKK'-> 'Danish crown' ;
add: 'GBP'-> 'British pound' ;
add: 'JPY'-> 'Japanese yen' ;
add: 'NOK'-> 'Norwegian crown' ;
add: 'RUR'-> 'Russian ruble' ;
add: 'SEK'-> 'Swedish crown' ;
add: 'INR'-> 'India rupees' ;
add: 'other'-> 'Another type of currency' .