Browse thread
Value shadowing
[
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: | David Allsopp <dra-news@m...> |
| Subject: | RE: [Caml-list] Value shadowing (tangent) |
> > however i understand why some people do it the first way. after the "in"
> > you're in some sort of new scope (previous scope augmented by your
> > let binds)
>
> On the other hand, the 'let' scope will end exactly at the same place as
> the englobing scope. Since you can't close one without closing the
> other,
That's not true.
let x =
let y =
let z = ()
in
()
in
() (* z no longer in scope *)
and a = ()
in
(* y and z no longer in scope *)
> it doesn't make a lot of sense (both practically and mentally) to
> distinguish them, thru indentation of otherwise.
Depends on whether you like to initialise non-trivial values with separate
one-off functions or with nested lets. Personally, I prefer the latter but
that's a matter of style/taste, not sense.
David