From: skaller <skaller@users.sourceforge.net>
To: Thomas Fischbacher <Thomas.Fischbacher@Physik.Uni-Muenchen.DE>
Cc: Markus Mottl <markus@oefai.at>,
Andrej Bauer <Andrej.Bauer@andrej.com>,
caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] environment idiom
Date: 13 Dec 2004 12:26:47 +1100 [thread overview]
Message-ID: <1102901206.2768.127.camel@pelican.wigram> (raw)
In-Reply-To: <Pine.LNX.4.58.0412130002080.1921@eiger.cip.physik.uni-muenchen.de>
On Mon, 2004-12-13 at 10:03, Thomas Fischbacher wrote:
> On Sun, 12 Dec 2004, skaller wrote:
>
> > So monadic programming with state transformers is NOT
> > referentially transparent or purely functional at all.
>
> Actually, it is. :-)
Actually it is pointless after I took the trouble
to explain why this is not the case, to make such
a bland statement.
It seems you missed entirely my point.
In some interpretation of the encoding it is self-evident --
which means it isn't open to question or contradiction --
that the code is NOT transparent.
The issue is to reformulate the meaning of 'encoding'
in such a way that the well-known advantages of transparency
are preserved.
There is no doubt WHAT SO EVER that Haskell programs
doing I/O have side effects, for example. Yet Haskell
per se, doesn't. How can this be?
The point is to *rescue* the basic conception from
the ridicule which, at the moment, it deserves.
The claims that monadic programming allows side effect
free transparent purely functional encoding is unquestionably
bogus. It can only be reinstated by more carefully specifying
exactly *which* encodings have those properties.
In particular with monads the combinators themselves
patently admit a higher level of encoding -- combinator
encodings -- which are NOT transparent, even if the terms
they manipulate and the combinator definitions are.
This is a new result for me -- functional code, when abstracted
to a higher level encoding, need not be functional. Perhaps this
is already known, and if not it will take a real theoretician
to state what I'm trying to say properly, but I have no doubt
at all the intent, though stated vaguely, is correct.
Hmm .. of COURSE it is already known. Indeed, languages like
Ocaml have long been classed as ISWIM-like. Such a language
is purely functional, when the handles of variables are
treated as values, but is not, when the values of the variables
themselves are admitted. The whole *point* of the technique
is to preserve the functional code and provide a clean
dividing line between the functional part and the mutable store.
Indeed I would bet there is a monadic interpretation of this,
which would give Haskell programmers Ocaml like references.
The point here is that *even* in languages like Ocaml where
references are used, lack of absolute transparency does
not make reasoning suddenly impossible. Despite the lack
of absolute transparency, it is still much easier to reason
about Ocaml than C++. Why? Because the core really is
functional, and somehow you can still reason about the
code 'as if' it were functional, and obtain a result pertaining
to correctness of the code, perhaps 'with some caveats'.
In particular, I would gues it is possible to reason the
code is *incorrect* assuming it is purely functional (ignoring
the values of references) and have that result hold, even
if references are used -- but I don't know for sure,
it may be one has to restrict the rules of inference.
Obviously one can show that:
let f x = f (1::x) in
let x = ref 0 in
f !x
will not terminate since we're invoking, in an eager language,
a nonterminating purely functional function... so the presence
of a reference is irrelevant. Of course this is a trivial
example, perhaps COQ programmers know better how to separate
the mutable fields out.
--
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
next prev parent reply other threads:[~2004-12-13 1:27 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-09 2:07 HENRIKSON, JEFFREY
2004-12-09 4:47 ` [Caml-list] " Jacques Garrigue
2004-12-09 6:02 ` Michael Walter
2004-12-09 11:28 ` Jacques Garrigue
2004-12-09 20:02 ` pad
2004-12-09 23:11 ` Jacques Garrigue
2004-12-10 2:30 ` skaller
2004-12-09 9:09 ` Richard Jones
2004-12-09 13:12 ` [Caml-list] " Ville-Pertti Keinonen
2004-12-10 11:59 ` Richard Jones
2004-12-10 10:52 ` [Caml-list] " Andrej Bauer
2004-12-10 12:13 ` Richard Jones
2004-12-10 23:35 ` Jacques Garrigue
2004-12-11 2:30 ` skaller
2004-12-11 14:31 ` Andrej Bauer
2004-12-11 18:13 ` Markus Mottl
2004-12-11 23:56 ` skaller
2004-12-12 2:36 ` William Lovas
2004-12-12 5:33 ` skaller
2004-12-12 19:09 ` Michael Walter
2004-12-13 0:48 ` skaller
2004-12-13 2:03 ` Michael Walter
2004-12-13 2:05 ` Michael Walter
[not found] ` <877e9a170412121844b633bb8@mail.gmail.com>
2004-12-13 2:45 ` Michael Walter
2004-12-13 6:18 ` skaller
2004-12-13 7:08 ` skaller
2004-12-13 9:56 ` Michael Walter
2004-12-13 12:59 ` skaller
2004-12-13 8:56 ` Thomas Fischbacher
2004-12-13 9:21 ` Jacques Garrigue
2004-12-13 10:05 ` Michael Walter
2004-12-13 10:29 ` Thomas Fischbacher
2004-12-13 21:16 ` Michael Walter
2004-12-13 10:20 ` Thomas Fischbacher
2004-12-13 12:09 ` Jacques Garrigue
2004-12-13 12:48 ` Thomas Fischbacher
2004-12-13 14:09 ` skaller
2004-12-13 21:39 ` Michael Walter
2004-12-13 13:22 ` skaller
2004-12-13 16:54 ` Marcin 'Qrczak' Kowalczyk
2004-12-13 18:44 ` Thomas Fischbacher
2004-12-13 10:11 ` Michael Walter
2004-12-13 11:46 ` skaller
2004-12-13 5:41 ` skaller
2004-12-13 9:29 ` Michael Walter
2004-12-13 12:30 ` skaller
2004-12-13 13:49 ` Martin Berger
2004-12-12 23:03 ` Thomas Fischbacher
2004-12-13 1:26 ` skaller [this message]
2004-12-13 8:37 ` Thomas Fischbacher
2004-12-13 10:53 ` skaller
2004-12-13 11:38 ` Martin Berger
2004-12-13 13:33 ` skaller
2004-12-13 12:01 ` Thomas Fischbacher
2004-12-13 13:41 ` skaller
2004-12-11 23:29 ` skaller
2004-12-12 0:21 ` Jacques Carette
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1102901206.2768.127.camel@pelican.wigram \
--to=skaller@users.sourceforge.net \
--cc=Andrej.Bauer@andrej.com \
--cc=Thomas.Fischbacher@Physik.Uni-Muenchen.DE \
--cc=caml-list@inria.fr \
--cc=markus@oefai.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox