From: Pascal Costanza on
Thomas F. Burdick wrote:
> On Oct 17, 5:59 pm, Ron Garret <rNOSPA...(a)flownet.com> wrote:
>
>> There are two types of capture situations, those that involve code that
>> is passed into the macro as an argument and appears in the macro
>> expansion, and code that surrounds the macro. AFAIK, the two types of
>> capture don't really have names, so I'll coin some new terminology:
>> let's call them INWARD and OUTWARD capture respectively. What you have
>> just described in inward capture, and it is fixed using gensyms.
>
> I like that terminology. Outward capture is a real problem in using
> defmacro with a Lisp-1, and it's awkward to describe without a good
> name for it.

Paul Graham uses the terms "macro argument capture" for what Ron
describes as "inward capture", and "free symbol capture" for "outward
capture" in his book "On Lisp".


Pascal

--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Ron Garret on
In article <7k0gm7F37rl9mU1(a)mid.individual.net>,
Pascal Costanza <pc(a)p-cos.net> wrote:

> Thomas F. Burdick wrote:
> > On Oct 17, 5:59 pm, Ron Garret <rNOSPA...(a)flownet.com> wrote:
> >
> >> There are two types of capture situations, those that involve code that
> >> is passed into the macro as an argument and appears in the macro
> >> expansion, and code that surrounds the macro. AFAIK, the two types of
> >> capture don't really have names, so I'll coin some new terminology:
> >> let's call them INWARD and OUTWARD capture respectively. What you have
> >> just described in inward capture, and it is fixed using gensyms.
> >
> > I like that terminology. Outward capture is a real problem in using
> > defmacro with a Lisp-1, and it's awkward to describe without a good
> > name for it.
>
> Paul Graham uses the terms "macro argument capture" for what Ron
> describes as "inward capture", and "free symbol capture" for "outward
> capture" in his book "On Lisp".

Potato, potahto. :-)

rg
From: Tim Bradshaw on
On 2009-10-18 04:11:45 +0100, Ron Garret <rNOSPAMon(a)flownet.com> said:

> I presume you meant "... by just NOT introducing such names" i.e. by
> using gensyms. That's right.

Yes, sorry.

>
> I'd phrase it slightly differently: outward capture is where the macro
> expansion contains a free reference, i.e. a reference that is not bound
> by the macro expansion itself. You have a choice of environment in
> which to resolve that free reference. You can resolve it in the
> environment where the macro is defined (this is what hygienic macros do)
> or you can resolve it in the environment where the macro is invoked
> (this is what CL does).

Yes. I was trying to avoid the term "macro" because I wanted to allow
it to be anything else.

> The DEFSTRUCT case is a complete red herring because the spec is
> ambiguous, so you can choose whether to use (unhygienic-)macro-like
> semantics with all its attendant problems, or function-like semantics.
> This is notwithstanding the fact that DEFSTRUCT is a macro. DEFUN is a
> macro too, but obviously the things that DEFUN defines have
> function-like semantics. It's a no-brainer that function-like semantics
> is the better choice because then everything is lexically scoped and the
> capture issues simply evaporate.

Yes, that''s why I didn't want to say "macro" - DEFSTRUCT obviously is
a macro, but it clearly is not relevant that it is, as it could
obviously (and I'm guessing everyone but Madhu thinks that it obviously
*should*) resolve any free references in the environment the macro is
defined.


From: Tim Bradshaw on
On 2009-10-18 05:40:55 +0100, Madhu <enometh(a)meer.net> said:

> [I see no need to invent new terminology which is then used to wrongly
> address the issues at hand]

We're inventing new terminology because as far as I'm aware there is no
existing terminology. If there is it's probably in the Scheme
community, but I don't know how they talk about these issues.

From: Tim Bradshaw on
On 2009-10-18 13:40:38 +0100, Pascal Costanza <pc(a)p-cos.net> said:

> Paul Graham uses the terms "macro argument capture" for what Ron
> describes as "inward capture", and "free symbol capture" for "outward
> capture" in his book "On Lisp".

I much prefer Ron's terminology, as it resonates so well with downward
/ upward funargs.