English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2004-12-13 (16:54)
From: Marcin 'Qrczak' Kowalczyk <qrczak@k...>
Subject: Re: [Caml-list] environment idiom
skaller <skaller@users.sourceforge.net> writes:

>> Referential transparency is about the substitution of definitions. 
>> Evidently, x <- ... is _not_ a definition. 
> But this is a bit circular.

But it's true. Referential transparency is relative to what is
considered a definition. It's not an absolute property if we don't
agree about the mapping between abstract concepts like "definition"
or "equality" and the features visible in the language.

Similarly, whether a function is considered pure depends on what do we
mean to "apply" a function, and what is a "side effect". For example
Haskell IO actions don't break purity if we consider Haskell's
function application as the operation which determines purity, but
they are impure if we treat IO and functions together. And a function
which returns a modified state is pure if we treat the state as one of
the arguments and a part of the result, yet it's impure if we consider
only other arguments as "real" arguments and treat state threading as
a part of the calling protocol. It's all relative.

   __("<         Marcin Kowalczyk
   \__/       qrczak@knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/