Version française
Home     About     Download     Resources     Contact us    
Browse thread
environment idiom
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] environment idiom
From: pad@ryxa.irisa.fr
> Michael Walter <michael.walter@gmail.com> writes:
> 
> > Is there such thing as implicit parameters in O'caml, basically
> > variables with dynamic extent. Could be (partially?) statically
> > checked, too, no?
> 
> The haskell guys have invented implicit parameter cos they dont have
> side effect or global variables.
> In O'Caml we have those features  so implicit parameter can easily be 
> emulated. The rest is more a syntactic sugar question.

Not exactly. Implicit parameters in Haskell also check that all the
needed definitions are available, which global variables don't (with
global variables there is always a default value). IIRC their
semantics is not exactly that of dynamic scope, but more a statical
scope with a special kind of substitution, which is somewhat cleaner.

But you're right that in practice global variables are in general
sufficient to solve this problem, and they are often used in ocaml for
that. They have of course one disadvantage: they are not reentrant.

Jacques Garrigue