Browse thread
[Caml-list] Yelling
[
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: | Eray Ozkural <exa@k...> |
| Subject: | Re: [Caml-list] Yelling |
Just what I was looking for (^_^) I didn't know of this syntax. I used functors here and there but I'm not too experienced in using signatures yet. I'm relatively new to ocaml and therefore constantly seeing things that surprise me! Thanks! On Wednesday 23 April 2003 17:56, Neel Krishnaswami wrote: > module Foo : FOO = > struct > type t = Foo of unit > > let v = Foo() > end > > module Bar : BAR with type t = Foo.t = > struct > include Foo (* Add the type t and value v to the Foo module *) > > let v' = v > end > > The "with type t = Foo.t" thing at the top of Bar is a sharing > declaration. It informs the compiler that the type Bar.t is the same > as the type Foo.t, so you can freely intermix Foo.t and Bar.t values. > (Otherwise the compiler would forbid it, on the grounds that these are > two different abstract types.) > > I hope this helps! -- Eray Ozkural (exa) <erayo@cs.bilkent.edu.tr> Comp. Sci. Dept., Bilkent University, Ankara KDE Project: http://www.kde.org www: http://www.cs.bilkent.edu.tr/~erayo Malfunction: http://mp3.com/ariza GPG public key fingerprint: 360C 852F 88B0 A745 F31B EA0F 7C07 AE16 874D 539C ------------------- 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