caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pixel <pixel@mandrakesoft.com>
To: Xavier Leroy <xavier.leroy@inria.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] simple typing question
Date: 02 Jul 2002 20:57:36 +0200	[thread overview]
Message-ID: <ly4rfidkkf.fsf@leia.mandrakesoft.com> (raw)
In-Reply-To: <20020702134226.A18305@pauillac.inria.fr>

Xavier Leroy <xavier.leroy@inria.fr> writes:

> No reasonably simple type system can distinguish both examples.  Many
> have been proposed -- this was a hot research topic in the 1980-1993
> time frame, and I even did my PhD on this very topic -- but none was
> found to be really usable in practice.  The value restriction on
> polymorphism (i.e. what Caml implements) is far from perfect, but is
> the "least bad" of the known solutions.

what about changing the semantic of partial application, restoring
eta-equivalence: a function is not evaluated unless every arguments
are given:

make_toggle()  <=>  fun x -> make_toggle () x


of course this makes functions like "make_toggle" quite useless:

# let make_toggle () =
    let r = ref [] in fun x -> let old = !r in r := x; old

would be semantically equivalent to

# let make_toggle () x =
    let r = ref [] in let old = !r in r := x; old

To get back the power of "make_toggle"-like functions, a special
function call could be added that would break eta-equivalence:
  call_now(make_toggle, ())
would have the semantic "make_toggle()" has in today's caml.


The rationale for this change would be that "make_toggle"-like
functions are seldom used, whereas "map"-like are used a lot.
Differentiating syntactically them would be nice.

But i don't think such a big change would do caml any good:
- are "make_toggle"-like functions really seldom used?
- performance drawbacks?


(i've been toying around the syntactical pb of partial application:
 http://merd.net/choices_syntax.html)
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2002-07-02 18:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-02  4:14 Michael Vanier
2002-07-02  9:14 ` Pierre Weis
2002-07-02  9:49   ` Michael Vanier
2002-07-02 11:29     ` Daniel de Rauglaudre
2002-07-02 11:42     ` Xavier Leroy
2002-07-02 18:57       ` Pixel [this message]
2002-07-02 20:59         ` Pierre Weis
2002-07-03  0:39           ` Pixel
2002-07-03  1:49             ` Jacques Garrigue
2002-07-03 23:24               ` Pixel
2002-07-03  7:51             ` Francois Pottier
2002-07-03 11:25               ` Pixel
2002-07-03 18:10       ` Lauri Alanko
2002-07-02 14:56     ` Pierre Weis

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=ly4rfidkkf.fsf@leia.mandrakesoft.com \
    --to=pixel@mandrakesoft.com \
    --cc=caml-list@inria.fr \
    --cc=xavier.leroy@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).