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... |
thanks for your reply, it's increasing my understanding of the object system,
although there are some (or more... :-) open points:
In:
class ['state] context s =
object (this:'self)
...
end
what are the reasons to give 'this' a type, and isn't 'self a type-variable? I
thought it ('this') has the type of the class (= _context) ? I don't
understand why and when it is needed to give the object a type.
The same with:
class state1 = object (this : _ #state) ... end
I thought class state1 is a subtype (or implementing the class-type) #state,
since the methods are the same. Why does it help to give the obejct a type?
thanks for your help, I would really like to understand the object system
better. The state machine is surely better written using records and
function; but this (supposed to be) little task is/was helping me indeed
learning more of the class system. (And I hate it, not being able to solve a
problem, which seems to be an easy one :-)
cheers
Michael