Hi Gambit List,
I really like the meroonet object system, however my program contains quite a few syntax-case macros and the meroonet common-lisp style macros don't work once syntax-case is loaded.
I've found that I can switch between the two macro systems using:
(define (switch-to-lisp-macros) (set! ##expand-source (lambda (src) src)))
(define (switch-to-syntax-rules-macros) (set! ##expand-source (lambda (src) (sc-expand src))))
... however this is both a hassle and a global change which I'm guessing prob won't work with threading etc..
Has anybody attempted to build a meroon style system using syntax-case macros? Any pointers would be much appreciated.
Many thanks,
Phil
Afficher les réponses par date
On Mar 22, 2007, at 4:11 AM, Phil Dawes wrote:
Has anybody attempted to build a meroon style system using syntax-case macros? Any pointers would be much appreciated.
I think this would be a worthwhile project, and I'd be eager to discuss it with any individual or group that might want to work on it.
That said, I don't know how to do it myself.
Brad
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 22-Mar-07, at 7:34 AM, Bradley Lucier wrote:
On Mar 22, 2007, at 4:11 AM, Phil Dawes wrote:
Has anybody attempted to build a meroon style system using syntax- case macros? Any pointers would be much appreciated.
I think this would be a worthwhile project, and I'd be eager to discuss it with any individual or group that might want to work on it.
Good idea. You should try to make it into a Snow package!
Marc
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 22-Mar-07, at 4:11 AM, Phil Dawes wrote:
Hi Gambit List,
I really like the meroonet object system, however my program contains quite a few syntax-case macros and the meroonet common-lisp style macros don't work once syntax-case is loaded.
I've found that I can switch between the two macro systems using:
(define (switch-to-lisp-macros) (set! ##expand-source (lambda (src) src)))
(define (switch-to-syntax-rules-macros) (set! ##expand-source (lambda (src) (sc-expand src))))
... however this is both a hassle and a global change which I'm guessing prob won't work with threading etc..
Has anybody attempted to build a meroon style system using syntax-case macros? Any pointers would be much appreciated.
Have you considered implementing define-macro on top of syntax-case? I'm not sure how much mileage you can get out of it, but here's one way of defining define-macro:
(define-syntax define-macro (lambda (x) (syntax-case x () ((_ (name . params) body1 body2 ...) (syntax (define-macro name (lambda params body1 body2 ...)))) ((_ name expander) (syntax (define-syntax name (lambda (y) (syntax-case y () ((k . args) (let ((lst (syntax-object->datum (syntax args)))) (datum->syntax-object (syntax k) (apply expander lst))))))))))))
Marc
Marc Feeley wrote:
Has anybody attempted to build a meroon style system using syntax-case macros? Any pointers would be much appreciated.
Have you considered implementing define-macro on top of syntax-case? I'm not sure how much mileage you can get out of it, but here's one way of defining define-macro:
[...]
Blimey - that works a treat. Thanks a lot!
Phil
On Mar 22, 2007, at 12:59 PM, Phil Dawes wrote:
Marc Feeley wrote:
Has anybody attempted to build a meroon style system using syntax- case macros? Any pointers would be much appreciated.
Have you considered implementing define-macro on top of syntax-case? I'm not sure how much mileage you can get out of it, but here's one way of defining define-macro:
[...]
Blimey - that works a treat. Thanks a lot!
There are several serious advantages to adapting the Meroon macros to use syntax-case directly:
1. In the past, when given incorrect syntax for Meroon forms, for define-class, say, the macro-expanders have crashed. This is very difficult to debug, and eventually led me to compile those files in (safe) mode rather than (not safe) mode. Even then, debugging crashes in macro expansion is no treat.
2. The Meroon code for "with-access" is bogus. To do this with define-macro, you need a code-walker, which Meroon does not have, and which syntax-case, because of its automatic renaming of variables in different contexts, has more-or-less by default. The with-access code in Meroon can easily be "fooled" to give totally bogus results.
So I'm still interested if someone wants to rewrite the Meroon macros using syntax-case.
Brad