Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Loup Vaillant" <loup.vaillant@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] How must we teach lexical scope?
Date: Thu, 29 Mar 2007 10:17:28 +0200	[thread overview]
Message-ID: <6f9f8f4a0703290117qf0fa062n6430a168e7acf5b7@mail.gmail.com> (raw)
In-Reply-To: <se4po5npc2.fsf@hod.lan.m-e-leypold.de>

2007/3/28, ls-ocaml-developer-2006@m-e-leypold.de
<ls-ocaml-developer-2006@m-e-leypold.de>:
> But perhaps I understand your problem better now: The difference
> you're wanting to make is the substitution of symbols by values at
> definition time vs. at evaluation time (I hope it is clear what I want
> to say).

Exactly.

> But you'll have to explain substitution at evaluation time
> anyway (when a function is called and the formal parameters are
> bound). I don't understand what your attempt to avoid to talk about an
> environment (from which a comes in the example above) will buy you.

Substitution at definition time is how I naturally thought of it. That
is, the definition:
# f x = a + x;;
was automatically replaced by:
# f x = 3 + x;;
in my head, so there were no more need for any environment.

However, I must admit such a way of thinking has its limits: as long
as the substitution is simple, that is easy. When a free variable is
some complicated piece of data (or even code), one (I) must switch to
an environment representation. In that case, the environment I think
about is only the set of free variables actually used by the function.
The environments our professors talked about included all values,
including the useless ones. I thought it was unnecessary, but I see
the trade-of, now: their process is quite long (not to mention the
syntactic burden of describing each environment) but it is systematic,
and simple. Because it is, it looks silly. I don't like environments,
but you convinced me I haven't came up with a better  solution.

Regards,
Loup


  reply	other threads:[~2007-03-29  8:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-28  7:59 Loup Vaillant
2007-03-28  8:49 ` [Caml-list] " Luc Maranget
2007-03-28 14:34   ` Loup Vaillant
2007-03-28 15:43     ` ls-ocaml-developer-2006
2007-03-28 17:09       ` Loup Vaillant
2007-03-28 19:24         ` ls-ocaml-developer-2006
2007-03-29  8:17           ` Loup Vaillant [this message]
2007-03-29 10:59             ` ls-ocaml-developer-2006
2007-03-28  9:49 ` Pierre-Evariste Dagand
2007-03-28 17:41 ` Pal-Kristian Engstad

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=6f9f8f4a0703290117qf0fa062n6430a168e7acf5b7@mail.gmail.com \
    --to=loup.vaillant@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