Browse thread
[Caml-list] Polymorphism and the "for" loop
[
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: | skaller <skaller@u...> |
| Subject: | Re: [Caml-list] Polymorphism and the "for" loop |
On Fri, 2004-10-22 at 05:11, David Brown wrote: > On Thu, Oct 21, 2004 at 07:50:43PM +0100, Jon Harrop wrote: > Because its only a warning, not an error. g is allowed to return any type. > It could be argued that the loop expression must be of type unit, then this > could also be inferred by type inference. It can also be argued chosing unit for non-returning function is the wrong choice and that correct choice is void. In particular given f: unit -> unit you can write f ( f () ) which is silly. Given f: unit -> void that expression won't type check. The result is to force 'commands' with side effects and no return values be 'top level' (or at least arguments of for, ';', etc). This seems to work well in Felix. -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net ------------------- 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