bug-kawa
[Top][All Lists]
Advanced

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

[Bug-kawa] [bug #14097] problem with (this) syntax within define-syntax


From: tk
Subject: [Bug-kawa] [bug #14097] problem with (this) syntax within define-syntax
Date: Thu, 11 Aug 2005 20:20:39 +0000
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/412.6 (KHTML, like Gecko) Safari/412.2

URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=14097>

                 Summary: problem with (this) syntax within define-syntax
                 Project: Kawa
            Submitted by: huh
            Submitted on: Thu 08/11/05 at 20:20
                Category: Scheme language
                Severity: 3 - Normal
              Item Group: Run-time exception
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open

    _______________________________________________________

Details:

There's a problem with the translation of the (this) syntax when
it occurs within define-syntax, illustrated in the code below. 
This code worked in 1.7, but fails in 1.8b. 

workaround: the defmacro implementation of the same syntax works fine.


$ cat this.scm
(define-syntax slot
  (syntax-rules ()
    ((_ obj slotname)
     (field obj (quote slotname)))
    ((_ slotname)
     (field (this) (quote slotname)))))

(define-simple-class <x> ()
  (x :init 0)
  ((incx) <void>
   (set! (slot x) (+ 1 (slot x))))
  ((incx2) <void>
   (set! (slot (this) x) (+ 1 (slot (this) x)))))

#|
(defmacro slot args
  (if (null? (cdr args))
      `(field (this) ',(car args))
    `(field ,(car args) ',(cadr args))))
|#

$ rlwrap java -jar kawa-1.8beta.jar 
#|kawa:1|# (compile-file "this.scm" "this.zip")
#|kawa:2|# (load "this.zip")
#|kawa:3|# (set! x (make <x>))
#|kawa:4|# (invoke x 'incx)
gnu.mapping.UnboundLocationException: unbound location $this$
        at gnu.mapping.Location.get(Location.java:67)
        at x.incx(this.scm:11)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at gnu.expr.PrimProcedure.apply(PrimProcedure.java:194)
        at gnu.mapping.CallContext.runUntilDone(CallContext.java:251)
        at gnu.mapping.CallContext.runUntilValue(CallContext.java:315)
        at gnu.mapping.MethodProc.applyN(MethodProc.java:105)
        at gnu.kawa.reflect.Invoke.applyN(Invoke.java:157)
        at gnu.kawa.reflect.Invoke.applyN(Invoke.java:51)
        at gnu.mapping.Procedure.apply(Procedure.java:124)
        at gnu.mapping.Procedure.apply(Procedure.java:116)
        at gnu.mapping.CallContext.runUntilDone(CallContext.java:251)
        at gnu.expr.ModuleExp.evalModule(ModuleExp.java:218)
        at kawa.Shell.run(Shell.java:229)
        at kawa.Shell.run(Shell.java:172)
        at kawa.Shell.run(Shell.java:159)
        at kawa.repl.main(repl.java:744)
#|kawa:5|# (invoke x 'incx2)
#|kawa:6|# 




    _______________________________________________________

Carbon-Copy List:

CC Address                          | Comment
------------------------------------+-----------------------------
address@hidden                 | 




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=14097>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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