caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jeremy Bem <jeremy1@gmail.com>
To: bluestorm <bluestorm.dylc@gmail.com>
Cc: caml-list List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Llama Light: a simple implementation of Caml
Date: Mon, 30 Aug 2010 16:49:50 -0400	[thread overview]
Message-ID: <AANLkTikTYKC=x_PftCNKwAn5PDokpEekw1QEfm==8YHL@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=G2e_6Tn5cOQ5OOPhTLPk6Lsqx2hazt+O+H7gH@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3146 bytes --]

[Re-adding caml-list: I thought this conversation about let-polymorphism
might be of wider interest.]

The "stability" property you mention is nice, but of course if you don't
have let-polymorphism then you get a different handy rewrite, namely the
equivalence of
  let x = e1 in e2  and   (fun x -> e2) e1
no?  I was surprised when I first realized this didn't hold in ML.

In your last paragraph, you seem to elide the distinction between
monomorphic and polymorphic let, implying that both are the bottom rung of
the type hierarchy...but I'm proposing that polymorphic let is already an
extension of a simpler system.  Does polymorphic let not seem "richer" than
lambda to you?  It certainly seems to me to affect the metatheory (although
recently I've been thinking more about set-theoretic sematics than the usual
type-theoretic properties).

Maybe I'm splitting hairs...overall it still seems reasonable to me to
exclude let-polymorphism from Llama Light, considering that the goal is be a
minimal base system, and this one appears to be perfectly practical.  I
can't tell whether you disagree with this.

-Jeremy

On Mon, Aug 30, 2010 at 4:06 PM, bluestorm <bluestorm.dylc@gmail.com> wrote:

> On Mon, Aug 30, 2010 at 7:03 PM, Jeremy Bem <jeremy1@gmail.com> wrote:
> > Right...thanks for the refresher.  I suppose I should implement this, as
> > technically it is not "ML" until I do.  I'm still wondering why this is
> > considered an essential and desirable feature.
>
> One reason it is interesting is that it gives you the following
> stability property,
> wich is good for refactoring (both by humans and by copmuters) for example
> :
>
>  let x = e1 in e2     is equivalent to    e2{x <- e1}  (e2 in wich
> all free occurences of x are replaced by e1)
>
> If let isn't polymorphic, then for example   let id x = x in (id 1, id
> 2)  doesn't work out.
>
> There are other cases where polymorphism may be useful locally. For
> example in Haskell, the ST monad use polymorphism to encode an
> information about the use of effects in your code : if all effect are
> used locally (so the function is "observationally pure", or
> "referentially transparent", while still using side effects inside),
> the result will be polymorphic in the state parameter of the ST monad.
> If it's not, we know a side effect has escaped, and the type system
> forbids you from "running" the monad.
>
>
> > If one can make local polymorphic definitions, why
> > not local types and local exceptions?
>
> In OCaml you can have local types and exceptions through the "let
> module = .. in .." construct.
>
> Note however that, on a "richness of the type system" scale, they're
> much higher in the hierarchy. Binders on value (lambda and let) are
> features of the simple lambda-calculus. Binding on types is a much
> more advanced feature, as it belongs to System F. Binders on module
> and functors (let module = ... in ..) is even richer, as it translates
> in system Fomega. It may not make a lot of difference to the
> programmer, but the metatheory needed to support each of these
> extension is quite different. Let-binding is the simpler of those.
>

[-- Attachment #2: Type: text/html, Size: 3893 bytes --]

  parent reply	other threads:[~2010-08-30 20:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-29  5:42 Jeremy Bem
2010-08-29 10:52 ` [Caml-list] " bluestorm
2010-08-29 16:37   ` Jeremy Bem
2010-08-29 18:42     ` Jeremy Bem
2010-08-30 10:57     ` ivan chollet
2010-08-30 15:57       ` Jon Harrop
2010-08-30 17:09         ` ivan chollet
2010-08-30 17:39           ` Jon Harrop
2010-09-01  6:21             ` ivan chollet
     [not found]     ` <AANLkTikbSKCiXVMNsp9DxkW1FxzTFTxDhE=gWPxnqyJ3@mail.gmail.com>
     [not found]       ` <AANLkTi=dVrqaMchpvPsipasevtNn4Wz_6MWq6nUXjD8E@mail.gmail.com>
     [not found]         ` <AANLkTi=G2e_6Tn5cOQ5OOPhTLPk6Lsqx2hazt+O+H7gH@mail.gmail.com>
2010-08-30 20:49           ` Jeremy Bem [this message]
2010-08-29 13:00 ` ivan chollet

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='AANLkTikTYKC=x_PftCNKwAn5PDokpEekw1QEfm==8YHL@mail.gmail.com' \
    --to=jeremy1@gmail.com \
    --cc=bluestorm.dylc@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).