Browse thread
environment idiom
[
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: | 2004-12-13 (18:45) |
From: | Thomas Fischbacher <Thomas.Fischbacher@P...> |
Subject: | Re: [Caml-list] environment idiom |
> 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. Haskell differs from other languages in the one important point that Haskell definitions have all the properties of what a mathematician would call a definition (maybe mod typeclass subtleties). And this is what referential transparency is about: is the notion of "definition" that a programming language gives you just the same as that in mathematics or not? > C also has 'definitions' but they're not at all the same > as Haskell ones. Precisely. And they do not behave like mathematical definitions, so C is not reftransparent. > 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. Well, the C statement x=x+1; may also look like an equation to the uninitiated, but everyone would perhaps agree with me that this is just a misinterpretation of symbols. > However clearly the ST monad is sometimes useful.. > can you explain when that is? Good question... -- regards, tf@cip.physik.uni-muenchen.de (o_ Thomas Fischbacher - http://www.cip.physik.uni-muenchen.de/~tf //\ (lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y) V_/_ (if (= x 0) y (g g (- x 1) (* x y)))) n 1)) (Debian GNU)