Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Function forward declaration?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-07 (13:52)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Function forward declaration?
On Wed, 2004-04-07 at 16:01, Nicolas Cannasse wrote:
> > What would this code do?

> What about "compilation error : recursive calls in forward declaration" ?

That's the whole point of having
forward declarations though  .. :)

> And what would this code do ?
> let f () = while true do () done

It blocks a thread. Not even marginally stupid,
a very common and correct construction at the heart
of every operating system, it even has a name "wait loop".

> IMHO, function forward
> declaration is such a thing : very useful in most of the cases, still
> theoricaly broken (as your example show), 

IMHO it isn't forward calling that is broken, 
but global variables.

> and this can be checked by the compiler.

How? *** 

What do you suggest if the compiler
is not sure if a variable is initialised or not?
Java bans, Felix allows, Ocaml forces the programmer
to hack.

*** This isn't a dumb question. Sophisticated algorithms
can chase down uninitialised values. The question is,
is it sensible in a language to have an error condition
be so elusive that a human can't determine whether
the error will be issued or not?

John Skaller,
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: