This post originated from an RSS feed registered with Agile Buzz
by James Robertson.
Original Post: Re: Type Safe Enums and my issues....
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Wicked Questions asks whether Smalltalk (or other languages) use type safe enums or real objects. Well - In Smalltalk, all we have are objects. You would model the behavior you want (as guessed below)
The problem is this: in Java, methods can either return some value or return no value (void). There might be cases where one might have to do some processing after decoding (an enum) and return some value. I suppose the handler interface can be defined to return Object (oops! casting sneaks in!), but then there are also situations where there will be nothing to return (returning null is ugly). I suppose two kinds of handlers are needed one where each method returns Object and another handler where each method returns void.
Does projects using Smalltalk or Eiffel have these 'type safe enums' at all ?%A0 Or is that when using those languages these entities are modelled as objects with behavior (this is my current uninformed guess)?