From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 906C0BB81 for ; Mon, 13 Dec 2004 14:22:40 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iBDDMdRU011287 for ; Mon, 13 Dec 2004 14:22:40 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA31213 for ; Mon, 13 Dec 2004 14:22:39 +0100 (MET) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iBDDMbtn014486 for ; Mon, 13 Dec 2004 14:22:38 +0100 Received: from [192.168.1.200] (ppp209-112.lns2.syd3.internode.on.net [203.122.209.112]) by smtp3.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id iBDDMY7D042193; Mon, 13 Dec 2004 23:52:35 +1030 (CST) Subject: Re: [Caml-list] environment idiom From: skaller Reply-To: skaller@users.sourceforge.net To: Thomas Fischbacher Cc: Jacques Garrigue , caml-list In-Reply-To: References: <877e9a170412121844b633bb8@mail.gmail.com> <877e9a1704121218456af9df9@mail.gmail.com> <20041213.182117.79057361.garrigue@math.nagoya-u.ac.jp> Content-Type: text/plain Message-Id: <1102944153.2578.234.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 14 Dec 2004 00:22:34 +1100 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 41BD97A0.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41BD979D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 sourceforge:01 wrote:01 evidently:01 haskell:01 haskell:01 monadic:01 int':01 grammar:01 specifier:01 argued:01 semantics:01 syntax:01 monadic:01 minor: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: On Mon, 2004-12-13 at 21:20, Thomas Fischbacher wrote: > Referential transparency is about the substitution of definitions. > Evidently, x <- ... is _not_ a definition. But this is a bit circular. It is suspect to use the Haskell definition of 'definition' and then say Haskell is referentially transparent, a property depending on the definition of 'definition', because you cannot apply that definition to any other language. C also has 'definitions' but they're not at all the same as Haskell ones. When I first read the text of Barbara Liskov's Substitution Principle I fell over laughing. The text makes so many assumptions about the kind of language it is dealing with it is useless. You could rewrite it for C++, using *initialisation* instead of substitution, for example. So when you're looking at monadic Haskell that contains x <- ... you can claim it isn't a definition.. but it surely looks like one.. more precisely it looks like an assignment. It's like me trying to argue -- repeatedly and heatedly -- that no matter what the C++ Standard says, there is no such type as 'const int'. There really isn't even though the grammar has a production which makes that a valid type specifier it doesn't denote a type distinct from int. Of course people argued I was wrong -- the Standard said so. > The notion of "substitution" of course only makes sense for this > "official" form. Right. But consider for a moment a meta-system with enough well thought out sugar that it had a calculus of its own. Just because the reduced form is transparent doesn't mean the sugar calculus is. I guess that's my point, badly stated. The sugar level *counts*. Just as Haskell counts, even though GHC generates C which generates assembler .. semantics and its relation to syntax -- such as exhibited by the referential transparency property of purely functional code appears to be a 'multilevel' phenomena. > This is a bit like > FORTRAN programmers asked to adjust themselves to C showing the attitude > that "at least, they can forget all that for/while/etc. mumbo-jumbo and > do everything with goto, as they are used to". Good point. > Coming back to the original question, which was whether one may "just > stick in some monadic stuff to get a notion of an `environment'", I'm > inclined to say that from the purely functional point of view, this > perhaps is not a good idea, as this is not just "a minor change to the > code" but changes pretty much anything of its original properties. However clearly the ST monad is sometimes useful.. can you explain when that is? -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net