Browse thread
[Caml-list] Function forward declaration?
[
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: | Nicolas Cannasse <warplayer@f...> |
| Subject: | Re: [Caml-list] Function forward declaration? |
> val g : unit -> int (* prototype; val is already reserved word *) > > let f () = (* ... *) g () > > (* some intervening code which makes it difficult to use let rec ... and *) > > let g () = (* ... *) 42 (* compiler checks that g matches proto *) > > What would this code do? > > val g : unit -> int > let f () = g () > let x = f () > let y = x + 1 > let g () = y What about "compilation error : recursive calls in forward declaration" ? And what would this code do ? let f () = while true do () done That's not because people can write stupid things using any language that you can forbid them to use some ways of programming. IMHO, function forward declaration is such a thing : very useful in most of the cases, still theoricaly broken (as your example show), and this can be checked by the compiler. Nicolas Cannasse ------------------- 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