bugKawa - Bugs: bug #14097, problem with (this) syntax within...

 
 

bug #14097: problem with (this) syntax within define-syntax

Submitter:  tk <huh>
Submitted:  Thu 11 Aug 2005 08:20:39 PM UTC
   
 
Category:  Scheme language Severity:  3 - Normal
Item Group:  Run-time exception Status:  Fixed
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 18 Nov 2005 09:14:33 PM UTC, comment #1: 

Fixed in CVS.
I also checked in your testcase into the testsuite.

Per Bothner <bothner>
Group administrator
Thu 11 Aug 2005 08:20:39 PM UTC, original submission:  

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|#

tk <huh>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 4 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-11-18 bothner StatusNone Fixed
    Assigned toNone bothner
    Open/ClosedOpen Closed
2005-08-11 huh Carbon-Copy- Added -email is unavailable-

Back to the top

Powered by Savane 3.13-4b48.
Corresponding source code