Browse thread
[Caml-list] Function call with a list of parameters
[
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: | Francois Pottier <francois.pottier@i...> |
| Subject: | Re: [Caml-list] Function call with a list of parameters |
Hello, Alain Frisch wrote: > Cyclic (aka recursive) types are necessary to type such an expression: > # fun x -> x # run (); x;; > - : (< run : unit -> 'b; .. > as 'a) -> 'a = <fun> This is slightly misleading. Such a type is really non-recursive, since it is an abbreviation for the following: < run : unit -> 'b; 'c > -> < run : unit -> 'b; 'c > The notation (t as 'a) allows sharing relationships to appear explicitly in print, yielding shorter and more readable types. It actually describes a recursive type only when 'a occurs within t, which is not the case in the example above. It happens e.g. when x is passed as a parameter to one of its own methods: # fun x -> x#compare(x);; - : (< compare : 'a -> 'b; .. > as 'a) -> 'b = <fun> -- François Pottier Francois.Pottier@inria.fr http://pauillac.inria.fr/~fpottier/ ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr