From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 71FD5BB81 for ; Fri, 10 Dec 2004 00:12:17 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iB9NCHFf002166 for ; Fri, 10 Dec 2004 00:12:17 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA15794 for ; Fri, 10 Dec 2004 00:12:16 +0100 (MET) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iB9NCEOF003237 for ; Fri, 10 Dec 2004 00:12:15 +0100 Received: from localhost (suiren [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.13.1/8.13.1) with ESMTP id iB9NCDx3023258 for ; Fri, 10 Dec 2004 08:12:13 +0900 (JST) Date: Fri, 10 Dec 2004 08:11:59 +0900 (JST) Message-Id: <20041210.081159.105772440.garrigue@math.nagoya-u.ac.jp> To: caml-list@inria.fr Subject: Re: [Caml-list] environment idiom From: Jacques Garrigue In-Reply-To: References: <20041209.134735.79249569.garrigue@math.nagoya-u.ac.jp> <877e9a170412082202790e2cfb@mail.gmail.com> X-Mailer: Mew version 4.0.64 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 41B8DBD1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41B8DBCE.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 irisa:01 o'caml:01 statically:01 haskell:01 o'caml:01 emulated:01 haskell:01 iirc:01 semantics:01 ocaml:01 writes:01 idiom:01 syntactic:01 scope:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: From: pad@ryxa.irisa.fr > Michael Walter 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