English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] ANNOUNCE: mod_caml 1.0.6 - includes security patch
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-01-20 (18:55)
From: Michal Moskal <malekith@p...>
Subject: Re: [Caml-list] ANNOUNCE: mod_caml 1.0.6 - includes security patch
On Tue, Jan 20, 2004 at 07:52:56PM +0200, Eray Ozkural wrote:
> On Tuesday 20 January 2004 19:34, you wrote:
> > Haskell is lazy, ocaml is strict. Consider following snippet of
> > ``ocaml'':
> >
> > let _ = f (x)
> >   where x = g ()
> >
> > Now, the reader of the code might take false impression that f() is
> > executed before g(). Of course there is no such danger with function
> > definitions in where blocks, but still I think readability is the reason
> > it is absent from ocaml.
> Such a reader would be equally confused by let blocks. The order of execution 
> is hardly the concern here.

	let _ =
	  let x = g () in
	  f (x)

First execute g(), then f(), plain and simple.

This may sound a bit heretic here, but this is how most programmers
think about program execution -- first do this, then do that. Even more
-- this is how ocaml works.

> I don't think the problem you mention has much to do with where syntax. Its 
> semantics is quite independent of evaluation strategy! 

Yes, of course you can have well defined semantic for any string of
characters. But that's not the point. You say it's more readable --
you're probably right. I say it *can* be confusing.

: Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv
: When in doubt, use brute force. -- Ken Thompson : {E-,w}-- {b++,e}>+++ h

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