chicken-users
[Top][All Lists]
Advanced

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

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


From: felix winkelmann
Subject: Re: [Chicken-users] define-syntax available *by default*?
Date: Wed, 3 Nov 2004 19:45:12 +0100

On Wed, 03 Nov 2004 15:06:09 +0000, Tony Garnock-Jones
<address@hidden> wrote:
> 
> That is, (and sorry if this is a dumb or repetitive question) what is
> the essential difference between
> 
>    (define-syntax foo
>      (syntax-rules ()
>        ((_) 123)))
> 
> expanding to something like
> 
>    (sc$register (make-toplevel-identifier-somehow-from 'foo)
>                 (lambda (x) .....))
> 
> and
> 
>    (define-macro foo
>       (lambda (x)
>          123))
> 
> expanding to something like
> 
>    (register-macro! 'foo (lambda (x) 123))
> 
> especially given that the lambda in the sc$register case contains only
> fully-expanded syntax objects?
> 

There is probably no big difference. I'm just unable to figure out how
this works with psyntax. :-)

For example:

% csi
#;1> ,x (define-macro (foo) 123)
(##core#elaborationtimeonly
  (##sys#register-macro 'foo (lambda () 123)))

% csi -syntax
#;1> ,x (define-macro (foo) 123)   ; goes via define-syntax, of course
(##sys#void)

In the latter case it all happens during macro-expansion, the environment
gets augmented with a new macro-definition. In the former case the
macro-defining form expands into code that can be stuffed into a file
and compiled.


cheers,
felix




reply via email to

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