Browse thread
state pattern...
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Michael Wohlwend <micha-1@f...> |
| Subject: | Re: [Caml-list] state pattern... |
On Monday 27 June 2005 00:13, james woodyatt wrote: > I tend to work in the functional style first, then transfer what I've > done into imperative style if there is a performance gain to be had by > it. Here's what I would do to make something like what you want: really very helpful, your code snippet. > > You get into a problem pretty quickly if the state class needs to be > aware of the full type of the context in order to compute the next > state. What that really means is that the context *is* the state, and > you need to rethink how the pattern is supposed to be applied to your > design. that's why in my code the function which does the work of the state and sets the new one gets the context as a parameter, but I didn't get this right. I know that the pattern has it's limitations... thanks Michael