[plt-scheme] On hygiene and trust

From: Sam TH (samth at ccs.neu.edu)
Date: Thu Jul 9 15:16:03 EDT 2009

On Wed, Jul 8, 2009 at 11:04 AM, Joe Marshall<jmarshall at alum.mit.edu> wrote:
>> I don't agree that defmacro is easy to use without a pattern
>> matching facility.  Again, write the example that you provide
>> (above) using defmacro; I doubt it will be simpler or easier
>> or more robust, or anything.
> Do you consider backquote a pattern matching facility?
> ;; Common lisp version of named-let
> (defmacro named-let (name bindings &body body)
>  `(LABELS ((,name ,(map 'list #'car bindings) , at body))
>     (,name ,@(map 'list #'cadr bindings))))

There's already a pattern matcher being used here - the argument list
destructures and binds various arguments to the macro, which in
something like `syntax-case' would be destructured with a pattern
matcher.  `defmacro' would look a lot less convenient without that.

sam th
samth at ccs.neu.edu

Posted on the users mailing list.