[Q] Enum style Object?

Brian T Rice water at tunes.org
Wed Feb 19 04:51:34 UTC 2003

On Tue, 18 Feb 2003, Eric Merritt wrote:

> This question probably has an obvious solution but I
> can't see it at the moment.
> For the most part my Java experience has proved to be
> useful in aqueak (squeak is like the garden of eden
> compared to java :) but I am having trouble getting my
> mind around a state machine. In java I would just
> create a state instance var thats a byte and tehn have
> a series of static final bytes that represent each
> state, in C/C++ I would use an enum. I can't, however,
> for the life of me figure out how to translate this to
> squeak. I guess maybe the states  would be class vars
> initialized  in the class initializer but this seems a
> bit strange to me. Would one of you point me in the
> right direction?

You can use symbols (for example, #stateOne #stopped #end) and compare
them with ==, which is pretty fast and lightweight.

Brian T. Rice
LOGOS Research and Development
mailto:water at tunes.org

More information about the Squeak-dev mailing list