[plt-scheme] On hygiene and trust

From: Joe Marshall (jmarshall at alum.mit.edu)
Date: Wed Jul 8 11:04:45 EDT 2009

> On Jul 7, 2009, at 8:52 PM, Joe Marshall wrote:
>> Syntax-case is uniformly painful for simple and complex uses.

On Wed, Jul 8, 2009 at 7:31 AM, Abdulaziz Ghuloum<aghuloum at gmail.com> wrote:
> I don't agree.  Show me a painful simple use.  Pick any simple
> macro you want: let, let*, or, and, cond, case, or any other
> macro of your choice to show the pain.

This came up the other day.  Transform something like this:

(define-event foo bar (arg1 arg2 ...)
   (form2 ...) etc.)

into something like this:

(define (foo$bar arg1 arg2 ...)
   (form2 ...) etc.)

>> defmacro is really easy to use and understand, but isn't hygienic.
> 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))))


Posted on the users mailing list.