Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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, 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