Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!pipex!uknet!festival!edcogsci!jeff
From: jeff@aiai.ed.ac.uk (Jeff Dalton)
Subject: Re: Macros vs. Special opertors (was Re: SETQ is to SET as LET is to ???)
Message-ID: <CzqyEn.8BC@cogsci.ed.ac.uk>
Keywords: lisp, common lisp, progv, let, unwind-protect, special form
Sender: usenet@cogsci.ed.ac.uk (C News Software)
Nntp-Posting-Host: bute-alter.aiai.ed.ac.uk
Organization: AIAI, University of Edinburgh, Scotland
References: <CzopDG.M06@cogsci.ed.ac.uk> <3atror$6i3@tools.near.net> <3avv57$j4n@sand.cis.ufl.edu>
Date: Thu, 24 Nov 1994 00:51:58 GMT
Lines: 38

In article <3avv57$j4n@sand.cis.ufl.edu> kem@prl.ufl.edu (Kelly Murray) writes:

>|> If PROGV were documented in the standard as being a macro, there would have
>|> to be a special form for it to expand into.  I.e. we would have to
>|> standardize something that plays the role of your operator
>|> WHATEVER-MAGIC-INTERNAL-STUFF-YOU-WANT.
>
>Exactly. While syntactically possible, progv has a "body" that must be
>compiled within the current lexical context.  In the macro->function definition,
>the body is passed at run-time as a list-structure, and doesn't get compiled.
>
>(let ((foo 10))
>  (progv '(*bar) '(20) (setq foo *bar*)) 
>  (+ 1 foo))
>
>must return 21, and not 11.

This reminds me that there may be a bug in the *progv I posted
earlier today.  If anyone spots one, please let me know.

Anyway, what does "must return 21, and not 11" have to do with whether
it gets compiled or not?  Sure, the body has to be able to refer to
lexical variables, but that's a different question.

Now (re)consider this:

>|> >  (defmacro progv (&rest whatever)
>|> >    `(do-a-progv-somehow ',whatever))
>|> >
>|> >  (defun do-a-progv-somehow (args)
>|> >    (whatever-magic-internal-stuff-you-want args))

There was a CL implementation that actually did this sort of
thing for DEFUN.  Yet the body was still compiled.  How can that be? 
Well, it's not for nothing that I used the name whatever-magic-
internal-stuff-you-want.

-- jd
