Just for your fun and horror

jhf@lanl.gov jhf@lanl.gov
Fri, 16 Feb 2001 17:19:18 -0700 (MST)


My apologies for being deliberately obtuse.  Of course, I understood
what you were saying, but my point is this:  The name of the monadic
"return" combinator is perfectly sensible to anyone who understands
the continuation semantics of imperative languages.  While it shouldn't
be necessary to be a denotational semanticist to program in Haskell,
I think it is essential to appreciate the philosophical difference
between the _being_ of functional programming and the _doing_ of
imperative programming, if you're going to play with something like
the I/O monad in Haskell.  If you don't grasp that when you construct
a monad, you're creating a value that represents an action, or in other
words have a basic understanding of the functional denotation of
an imperative command, you don't really understand what you're "doing"
with monads, and your program is likely not to compute what you intend.
In this sense, maybe it's better not to change the (initially) confusing
"return" name, but to regard it as a pons asinorum that the student
must cross.


On 16-Feb-2001 Matthias Felleisen wrote:
>    From: jhf@lanl.gov
>    X-Priority: 3 (Normal)
>    Content-Type: text/plain; charset=us-ascii
>    Date: Fri, 16 Feb 2001 16:53:13 -0700 (MST)
>    Organization: Los Alamos National Laboratory
>    Cc: karczma@info.unicaen.fr, haskell-cafe@haskell.org
>    On 16-Feb-2001 Matthias Felleisen wrote:
>    > 
>    > Because imperative languages have named one half of the denotation (the
>    > value return) and not all of it for a long long long time. It's too late
>    > for Haskell to change that. -- Matthias
>    Well now, if I am to understand what a return statement in C does,
>    I must realize not only that it may return a value to a calling
>    routine, but also that it preserves the store.  If it allowed
>    the store to vanish, it wouldn't be very useful, would it?
>    So I don't see how it's reasonable to assert that "return"
>    means only one of these two things to a C programmer.
>    Cheers,
>    --Joe
> Let me spell it out in detail. When a C programmer thinks about the
> 'return' type of a C function, he thinks about the value-return half 
> of a return statement's denotation. The other half, the modified store, 
> remains entirely implicit as far as types are concerned. This is what 
> Jerzy's exam question was all about. 
> -- Matthias

Joseph H. Fasel, Ph.D.              email: jhf@lanl.gov
Technology Modeling and Analysis    phone: +1 505 667 7158
University of California            fax:   +1 505 667 2960
Los Alamos National Laboratory      post:  TSA-7 MS F609; Los Alamos, NM 87545