From: oleg@pobox.com
To: loup.vaillant@gmail.com, caml-list@inria.fr
Subject: Re: How must we teach lexical scope?
Date: Wed, 28 Mar 2007 20:45:46 -0700 (PDT) [thread overview]
Message-ID: <20070329034546.2AF4DAD35@Adric.metnet.fnmoc.navy.mil> (raw)
Loup Vaillant wrote:
> Personally, I think environments are about the implementation of
> lexical scope, not its specifications.
I agree. A language system that eagerly performs substitutions
inherent in the beta-rule needs no environments. An environment, which
is a list of pending substitutions, is merely an optimization. A quite
good optimization though. This is discussed in an article
http://okmij.org/ftp/Scheme/misc.html#closure-misconceptions
Regarding free variables: some of the multi-staged languages,
including MetaOCaml, can literally manipulate code with `free
variables'. For example,
let bar u = print_endline "here"; .<.~u + 1>. in
.<fun x -> .~(bar .<x+3>.)>.;;
Evaluating this code prints the string "here" and returns a code
value, which can be printed as .<fun x_1 -> ((x_1 + 3) + 1)>.
We note that the function bar received a piece of code .<x+3>.
containing a free variable 'x' and incorporated that piece of code
in the larger code. All while the binding for "x", "fun x -> ..." will
be evaluated only in the future.
next reply other threads:[~2007-03-29 3:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-29 3:45 oleg [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-03-28 7:59 Loup Vaillant
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=20070329034546.2AF4DAD35@Adric.metnet.fnmoc.navy.mil \
--to=oleg@pobox.com \
--cc=caml-list@inria.fr \
--cc=loup.vaillant@gmail.com \
/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