Problem using MyType[] in macros

Per Bothner per@bothner.com
Sun Jan 22 19:29:00 GMT 2012


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/



More information about the Kawa mailing list