This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: evaluating syntax transformer threw unbound location first
- From: Panicz Maciej Godek <godek dot maciek at gmail dot com>
- To: Per Bothner <per at bothner dot com>
- Cc: kawa at sourceware dot org
- Date: Mon, 16 Dec 2013 10:59:43 +0100
- Subject: Re: evaluating syntax transformer threw unbound location first
- Authentication-results: sourceware.org; auth=none
- References: <CAMFYt2ZnTnpc7FXhFhUpcD3=uyyWT+q4nkfNjjPLo-RyBcAMKA at mail dot gmail dot com> <52AC04DB dot 2070700 at bothner dot com> <CAMFYt2ZzemScXfB6bLvTdqZp7nW6prgK=vev_0g---1nNOykow at mail dot gmail dot com> <52AE5B4F dot 7010305 at bothner dot com>
2013/12/16 Per Bothner <per@bothner.com>:
[...]
> Nothing obvious comes to mind, and I'm a little overwhelmed right now.
>
> Note the expand procedure is an approximation. It does expansion
> in a different context than the normal, and the translation back
> to Scheme forms is an approximation. However, the presence of the
> TemplateScope forms and calls in the output does suggest some
> incomplete expansion.
>
> Do note that the reader expands:
> datum1:datum2
> to:
> ($lookup$ datum1 (quasiquote datum2))
Just for the record, the form of the macro currently being
used (which is meant to be equivalent to the one previously
given, but has the advantage that it works) follows:
(define-syntax define-application-views
(lambda (stx)
(syntax-case stx (show)
((define-application-views activity-name . names+views)
(with-syntax ((show (datum->syntax #'define-application-views 'show)))
#`(activity
activity-name
(on-create-view
(letrec (#,@(datum->syntax stx
(letrec ((range (lambda(start end)
(if (= start end)
'()
`(,start
,@(range (+ 1 start) end))))))
(map (lambda (name+view id)
`(,(car name+view) ::int ,id))
(syntax->datum #'names+views)
(range 0 (length
(syntax->datum #'names+views))))))
(activity-name ::android.widget.ViewFlipper
(view-flipper))
(show
(lambda (view)
(invoke activity-name 'setDisplayedChild view))))
#,@(datum->syntax stx
(map (lambda(name+view)
`(invoke ,(syntax->datum #'activity-name)
'addView ,(cadr name+view)))
(syntax->datum #'names+views)))
(as android.view.View activity-name)))))))))
Best regards,
M.