Re: #!quote

Matthias Radestock <[email protected]>
Newsgroups gmane.comp.java.sisc.devel
Organization LShift Ltd
Message-ID <[email protected]>
Turadg Aleahmad wrote:

> Revision 1.4 of sisc/modules/optimizer/main.scm changed uses of QUOTE to 
> #!QUOTE .

Scott may know a way of fixing your problem. However, it occurred to me 
that what you'd really want is to redefine DEFINE so that you can get 
hold of the *original* (pre macro expansion) body.

Something like

(define-syntax define
   (let-syntax ([old-define define])
      (syntax-rules (lambda)
        [(_ x (lambda formals . body))
         (old-define x (let ([p (lambda formals . body)])
                          (set-procedure-propery! p 'body
                             '(lambda formals . body))))]
        [(_ . rest) (old-define . rest)])))

would be great, but doesn't work. Scott, do you know of any way of doing 
this in psyntax? It seems to be quite a fundamental shortcoming.

Note that

(let-syntax ([old-define (syntax-rules ()
                            [(_ . rest) (define . rest)])])
   (define-syntax define
     (syntax-rules (lambda)
       [(_ name (lambda formals . body))
        (old-define name (let ([p (lambda formals . body)])
                           (set-procedure-property! p 'definition
                                                    '(lambda formals . 
body))
                           p))]
       [(_ (name . formals) . body)
        (define name (lambda formals . body))]
       [(_ . rest) (old-define . rest)])))

     (define (foo x) x)))

*does* work, i.e. afer executing the above,
   (procedure-property foo 'definition)
yields
   (lambda (x) x)
So one way to approach the problem would be to change the repl and load, 
or perhaps just eval, to stuff all expressions into a wrapper like the 
above.


Matthias.



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.