This is the mail archive of the kawa@sources.redhat.com 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]

nested macro invocation problem


Hi,

just bumped onto another trouble with macros defined with define-syntax. I have two macros defined in
different scheme files. The first macro is named symbol-append, it is defined in bug1.scm. The second is
defined in bug.scm and uses the first macro in its syntax-rules clauses. The contents of bug1.scm is
made accessible with `require' clause.


The problem is in that the first macro is not expanded as it should, but invalid code sequence is generated
(an attempt is made to treate macro as procedure
and macro object is used instead of macro name, which causes java.lang.VerifyError to be thrown.


Here is java code produced from bug.class:

public final Macro $Prvt$symbol$Mnappend = bug1.symbol$Mnappend;
... public final void apply(CallContext $ctx) {
...
gnu.mapping.Procedure procedure
= Interpreter
.getSymbolProcedure(/*TYPE_ERROR*/ $Prvt$symbol$Mnappend);


Regards,
Vladimir
;; -*-scheme-*-

(define-syntax symbol-append
  (syntax-rules ()
    ((symbol-append s1 s2 ...)
     (invoke (make <java.lang.StringBuffer>) 'append s1))))
;; -*-scheme-*-

(require <bug1>)
(define-syntax bug
  (syntax-rules ()
    ((bug s1 s2)
     (symbol-append s1 s2))))

(bug 'a 'b)

#|

;; This does not initialize the static field as it should. FIXED
(define-constant theConstant 'theValue)
;;(define-constant theConstant :: <String> 'theValue)

(require <bug1>)
(define (test a)
  (let((bug1(object:toString a)))
    bug1))



(define-simple-class a ()
  (b init-form:
     ;; this prints #!null instead of procedure
     (display (lambda(e)(display e)(newline))))
  )

(make a)

(let loop((names '())
	  (accu '()))
  (if (pair? names)
      (let((name (car names)))
	(loop
	 (cdr names)
	 (cons 1 accu)))
      accu))


(define (my-func self path)
  (object
   ()
   
   ((getChildren)
    (my-func (this) path)
    )

   ((getChildAt)
    (getChildren))
   ))

(object ()
	(myField init-form:
		 (format #t "this: ~a\n" (this))
		 ))
(define (my-func)
  (object
   ()
   (any-field
    init-value:
    (object ()
	    ((any-method) (any-function)))
    )))
|#


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