[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Re: [Chicken-users] New to Scheme Macros
From: |
John Cowan |
Subject: |
Re: Re: [Chicken-users] New to Scheme Macros |
Date: |
Wed, 22 Apr 2009 17:21:08 -0400 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Jordan Cooper scripsit:
> Explicit renaming macros look neat; the only kinda "bummer" thing is
> having to manually pull apart the components of the expression with
> car/cdr/etc. instead of the destructuring happening in a more
> automatic way. Of course, I imagine one could write a macro to do
> this... :)
Yes. Someone should port "destructuring-bind" to Scheme.
Note that the gensym approach used in CL only solves part of the problem
of macro hygiene. It prevents the macro code from binding names that
are used in the macro body with the expectation that the bindings at
the macro call are in effect.
However, gensyms do not and cannot protect the macro code itself
from bindings that are in place at the point of call, when the macro
code expects those names to be bound at the point of macro definition
(typically globally). For example, if a non-hygienic macro calls the
list procedure, and at the point of call the code has bound the name
"list" to something else, the macro is screwed.
This risk exists in CL, but is mitigated by the presence of separate
function and variable namespaces, and by the fact that the names exported
from the "lisp" package cannot be rebound or changed. It's still possible
for this problem to bite CL macro writers, and it can't be prevented (as
opposed to avoided) unless the CL implementation provides an additional
hygienic macro system that expands *all* code.
--
At the end of the Metatarsal Age, the dinosaurs John Cowan
abruptly vanished. The theory that a single address@hidden
catastrophic event may have been responsible http://www.ccil.org/~cowan
has been strengthened by the recent discovery of
a worldwide layer of whipped cream marking the
Creosote-Tutelary boundary. --Science Made Stupid
- [Chicken-users] New to Scheme Macros, Jordan Cooper, 2009/04/22
- Re: [Chicken-users] New to Scheme Macros, Thomas Chust, 2009/04/22
- Re: [Chicken-users] New to Scheme Macros, John Cowan, 2009/04/22
- Re: Re: [Chicken-users] New to Scheme Macros, nefigah, 2009/04/22
- Re: Re: [Chicken-users] New to Scheme Macros, Jim Ursetto, 2009/04/22
- Re: Re: [Chicken-users] New to Scheme Macros, Jim Ursetto, 2009/04/22
- Re: Re: [Chicken-users] New to Scheme Macros, Jordan Cooper, 2009/04/22
- Re: Re: [Chicken-users] New to Scheme Macros,
John Cowan <=
- Re: Re: [Chicken-users] New to Scheme Macros, Jordan Cooper, 2009/04/22
- Re: Re: [Chicken-users] New to Scheme Macros, John Cowan, 2009/04/22
- Re: Re: [Chicken-users] New to Scheme Macros, Jim Ursetto, 2009/04/22
- Re: Re: [Chicken-users] New to Scheme Macros, John Cowan, 2009/04/22
- Re: [Chicken-users] New to Scheme Macros, Alex Shinn, 2009/04/22