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: | Marcin 'Qrczak' Kowalczyk <qrczak@k...> |
| Subject: | Re: [Caml-list] Function forward declaration? |
W li¶cie z ¶ro, 07-04-2004, godz. 08:01 +0200, Nicolas Cannasse napisa³:
> > 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" ?
At which point? What are the correctness criteria in general?
For forward declarations to be useful, they would need to give something
more than let rec. But I don't see a safe subset which is larger than
let rec and doesn't need runtime checking.
(In my language something like the above is legal, even without a
forward declaration. Using g from f does a runtime check that the
definition of g has been already executed. The check is avoided in cases
it's easy to be proven unnecessary, e.g. with mutual recursion between
successive function definitions.)
--
__("< Marcin Kowalczyk
\__/ qrczak@knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/
-------------------
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