chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Redefining macros and special forms


From: Michele La Monaca
Subject: [Chicken-users] Redefining macros and special forms
Date: Tue, 28 Oct 2014 21:16:59 +0100

Hi,

shadowing a macro doesn't seem to work properly in all the cases:

(define-syntax my-begin (syntax-rules () ((_ x ...) (begin x ...))))
(let ((my-begin -)) (my-begin 0 1)) ; => -1 (ok)
(define my-begin -)
(apply my-begin '(0 1))             ; => -1 (ok)
(my-begin 0 1)                      ; =>  1 (oops)

Thus `my-begin' acts as either a procedure or a macro depending on the context.

Redefining `begin' (or even `##core#begin') has the same
unsatisfactory behavior:

(let ((begin -)) (begin 0 1)) ; => -1
(define begin -)
(apply begin '(0 1))          ; => -1
(begin 0 1)                   ; =>  1

Is this the expected  behavior?

Regards,
Michele



reply via email to

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