Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] implementing the visitor pattern in ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Samuel Lacas <Samuel.Lacas@t...>
Subject: Re: [Caml-list] implementing the visitor pattern in ocaml
Hi, you need to use coercions here (at least, that's the way it works
with me). Simply declare

method accept (v : abstractvisitor) = v#visit_foo(self :> foo)

in class foo.
Have a look at section 3.11 of the manual for more information.

Hope this helps,

sL

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners