[
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: | Christophe TROESTLER <debian00@t...> |
| Subject: | Re: [Caml-list] objects and functions |
On Thu, 22 May 2003, Damien <Damien.Pous@ens-lyon.fr> wrote: > > so, is there a way (or wouldn't it be useful to have one) for doing > something like : > >class a = function > >| 0 -> object method calc = 0 end > >| x -> object method calc = 33 mod x end > or > >class b x = object > > inherit fa x > > ... > >end What about: class a x = let x = match x with 0 -> 0 | x -> 33 mod x in object method calc = x end;; class b x = object inherit (a x) end;; Cheers, ChriS ------------------- 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