Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Eray Ozkural <exa@k...>
Subject: Re: [Caml-list] ANNOUNCE: mod_caml 1.0.6 - includes security patch
On Wednesday 21 January 2004 01:00, Brian Hurt wrote:
> That peice of code would be equivelent to:
> let _ =
>     let x = g () in
>     f x
> ;;
>
> So precision isn't lost, just hidden.
>
> I would think the following might be more of a problem:
>
> let x = ... ;;
>
> let _ = f x
> (* at this point, does the compiler know which x to use? *)
> where x = g ()
> ;;
>

Compiler knows which x to use, let and which differ only in syntax! Semantics 
is the same.

> Even more hideous possibilities arise:
>
> let rec f x =
>     let x = f (x + 3)
>     in
>     f (2 * x)
>     where f x = 2 + (f x)
>     and x = 3
> ;;
>
> I admit that I can't follow which fs and which xs are which, and what the
> result of that function would be (it'd be typed int -> int, that is
> clear).  Even a simple question like "does f 3 even terminate?" is not at
> all obvious, let alone what answer it'd return.
>
[snip]

Yes, admittedly, it's a terrible code :)

However, I will unfortunately have to insist that "where" is neither redundant 
nor error prone. It's one of the most elegant syntactic sugar's I've seen in 
a long long while. Especially when you are writing down a mathematical 
formulae, it makes things clearer. Putting every little variable in module 
scope isn't a substitute for me.

What I meant was that the absence of "where" in ocaml does not seem to me "by 
design" as another poster claimed. Ocaml is not (and quite possibly cannot 
be) the perfect language although it is the best programming language 
IMHO!!!!

Cheers,

-- 
Eray Ozkural (exa) <erayo@cs.bilkent.edu.tr>
Comp. Sci. Dept., Bilkent University, Ankara  KDE Project: http://www.kde.org
www: http://www.cs.bilkent.edu.tr/~erayo  Malfunction: http://mp3.com/ariza
GPG public key fingerprint: 360C 852F 88B0 A745 F31B  EA0F 7C07 AE16 874D 539C

-------------------
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