chicken-users
[Top][All Lists]
Advanced

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

Fwd: [Chicken-users] define-syntax available *by default*?


From: Michele Simionato
Subject: Fwd: [Chicken-users] define-syntax available *by default*?
Date: Tue, 26 Oct 2004 16:37:44 +0200

On Tue, 26 Oct 2004 11:16:41 +0100, Tony Garnock-Jones
<address@hidden> wrote:
> Hi all.
>
> Would it cause a lot of pain to switch on the standard syntax-rules (and
> possibly also syntax-case) macro systems by default in csi and csc?
>
> I find myself wanting to use syntax-rules/syntax-case more often than
> plain-old-lisp-macros these days; considering also that a compatibility
> "define-macro" form can be defined in terms of syntax-case, it seems
> that little would be lost by making the switch.
>
> Tony
>

>From an email I sent to Felix in August:

I take back my statement "high-level define-macro works better than
low-level define-macro".

For some reason it is subtly different: in particular it DOES not
work with an inner define-macro inside another define-macro, even in
the REPL, wherea the low-level system has not problems.

Also, I cannot get this to work
in compiled code:

;; how to make avalaible symbols extracted from an assoc-list

(eval-when
(eval compile)
(define bindings '((x 1) (y 2))))

(define-macro (using name . body)
  `(letrec ,(eval name)
     ,@body))

(using bindings (print x y))

This works with the low-level macrology; with psyntax works when
interpreted but not when compiled. Is this related to what you say
of high-level macros being not compilable? Is there any way to work around
this?

-------------------

Felix reply (I think I can make it public):

This just another sign of the fact that psyntax doesn't integrate
completely well into chicken: eval-when expands into a chicken-specific
special form, and then the inner define will be treated by psyntax as
a non-toplevel define that doesn't occur at the start of a body
(which is illegal). Just replace the `define' with `set!' (and take
advantage of chicken's identical treatment of toplevel `define' and `set!'
;-).

Sorry, I have no better workaround for this. The proper way would be to
hack psyntax to make it recognize eval-when (or better: chicken's
eval-when). But I'm quite slow understanding the psyntax code.




reply via email to

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