This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question about macros and Kawa


Per,

Yes, indeed, your suggestion regarding the newest preferred syntax works.
Namely:
(define-syntax make-junk3
  (lambda (stx)
    (syntax-case stx ( f1: f2:  )
                 ((make-junk f1: the-command f2: subcommand)
                  (datum->syntax-object
                   (syntax make-junk)
                   `(let* ((c (make junk)))
                      (set!  f1:c ,(syntax-object->datum (syntax the-command)))
                      (set!  f2:c ,(syntax-object->datum (syntax subcommand)))
                      c))))))

Invoking make-junk3 works.

But this does not:
(define-syntax make-junk2
  (lambda (stx)
    (syntax-case stx ( f1: f2:  )
                 ((make-junk f1: the-command f2: subcommand)
                  (datum->syntax-object
                   (syntax make-junk)
                   `(let* ((c (make junk)))
                      (set!  (*:.f1 c) ,(syntax-object->datum (syntax the-command)))
                      (set!  (*:.f2 c) ,(syntax-object->datum (syntax subcommand)))
                      c))))))

Invoking make-junk2 gives this result:

#|kawa:32|# (make-junk2 f1: 2 f2: 3)
#|kawa:33|# /dev/stdin:28:30: unbound location *:.f1
    at gnu.mapping.Location.get(Location.java:67)
    at atInteractiveLevel$5.run(stdin:28)
    at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:297)
    at gnu.expr.ModuleExp.evalModule(ModuleExp.java:185)
    at kawa.Shell.run(Shell.java:283)
    at kawa.Shell.run(Shell.java:194)
    at kawa.Shell.run(Shell.java:175)
    at kawa.repl.main(repl.java:847)

Thanks,

John Whittaker





----- Original Message ----
> From: Per Bothner <per@bothner.com>
> To: John Whittaker <john.whittaker@kc.rr.com>
> Cc: kawa@sources.redhat.com
> Sent: Wed, June 2, 2010 2:15:20 AM
> Subject: Re: question about macros and Kawa
> 
> On 06/01/2010 09:39 PM, John Whittaker wrote:
> Why is it that I cannot 
> use Kawa's shorthand (and normal) method
> invocation syntax in my macros, 
> but the old-style or more primitive
> "invoke" works?

You means 
> your first version works, but the second doesn't?
Not obvious to me why that 
> is, but you might want to try
this variation, which uses the current 
> preferred syntax:

(set!  f1:c ...)

I also suspect you can 
> make make the syntax-case macro
prettier by using #` but I haven't tried to 
> work that out.

> By the way, I just love Kawa.  I only wish I 
> could get the Eclipse Java
> debugger to work with it again.  JSwat 
> sort of works, but the Eclipse
> debugger with Schemescript would be ohhh 
> so nice.

Thanks!  Yes, it would be nice to get all this stuff 
> working.
--     --Per Bothner

> ymailto="mailto:per@bothner.com"; 
> href="mailto:per@bothner.com";>per@bothner.com  
> href="http://per.bothner.com/"; target=_blank >http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]