Browse thread
[Caml-list] Five Questions about Objects
[
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: | Jacques Garrigue <garrigue@k...> |
| Subject: | Re: [Caml-list] Five Questions about Objects |
From: Alain Frisch <frisch@clipper.ens.fr> > On Sun, 14 Jul 2002, YAMAGATA yoriyuki wrote: > > > However, I wonder why a class is necessary in the first place. I'm > > not familiar with the theory of OOP, but I feel like direct creation > > of objects is possible in functional languages. > > It is already possible in OCaml, thanks to local modules: > > "object ... end" > ===> > let module M = struct class o = object ... end end in new M.o > > It would be straightforward to define a Camlp4 syntax extension for this. This only works if your object has a monomorphic type. The real point is that if object definitions were really first class in the language, they would not be restricted by these strange variable binding conditions: type inference would be enough. Since there is no theoretical problem here, it may well be a useful extension. Jacques Garrigue ------------------- 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