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: Problem using MyType[] in macros


On 01/22/2012 09:42 AM, Bill Robinson wrote:
Hi.

Hi again,

I'm trying to make some macros that generate classes. I have come
unstuck trying to expand a java array type with a [] after an expanded
type name to make it an array.

I've made a simplified test case to demonstrate this:

File test.macros.scm:

(define (my-type-helper in)
   (syntax-case in (array)
     (my-integer
      (syntax int))
     ((array element-type)
      (with-syntax ((final-element-type (my-type-helper (syntax element-type))))
		  (syntax final-element-type[])))))

You need to add my-integer to the literals list.


define (my-type-helper in)
  (syntax-case in (array my-integer)
    (my-integer
....

Note just a few days ago I checked in an implementation of
bound-identifier=? and re-wrote the implementation of free-identifier=?.
They might be useful.  Or just using identifier?

(define (my-type-helper in)
  (syntax-case in (array)
    (my-integer (identifier? #'my-integer)

Or you could try re-ordering the two clauses in my-type-helper.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


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