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: evaluating syntax transformer threw unbound location first


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.


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