[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] miscmacros hygienic

From: Jim Ursetto
Subject: [Chicken-users] miscmacros hygienic
Date: Wed, 28 May 2008 21:33:05 -0600

I ported miscmacros (attached) to the hygienic branch and had a couple

First, is anyone using miscmacros?  I was wondering about the following
proposed change to the anaphoric macros:

Current             -> Proposed
(if* x y z)         -> (if* (it x) y z)
(while* test body)  -> (while* (it test) body)
(repeat* test body) -> (repeat* (it test) body)

I think it's nicer not to break hygiene by introducing a hidden 'it'
identifier--like dotimes does not.  In the port I actually implemented them
both ways; you just have to uncomment the desired behavior.  Thoughts?

Also--the miscmacros module uses a few bindings from the chicken module:

(import (only chicken
              when unless handle-exceptions
              let-optionals make-parameter))

However adding this import line to miscmacros is basically useless (as far as I
can tell) because the macros are expanded in the caller's environment, so the
caller is the one who needs to do the import from chicken.

I'd like to know the proper way to handle this, if any.  Does the caller
need to explicitly import any dependencies?

Similarly, as while* actually expands into an invocation of if*, it does
not work for the caller to do (import (only miscmacros while*)), as the
if* in the resulting expansion of while* will be undefined.

In fact the following doesn't look hygienic at all:

  #;1> (module foo ()
    (import scheme (only miscmacros while*))
    (define-syntax if*
      (lambda (f r c) (error 'bad)))
    (while* (it (> 0 5)) (display it)))

  Error: during expansion of (if*1305 ...) - bad

Is this a bug or am I just confused?

Attachment: miscmacros.egg
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]