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: Macros for Android


> Start by replacing the non-hygienic and deprecated defmacro
> by the hygenic and supported define-syntax-case.  The defmacro
> documentation shows how:
> If you use defmacro you really are on your own.

That gives me the following version:

(define-syntax-case 
  do-in-background ()
  ((_ dib-param dib opu-param opu params)
   #`(let* ((async-task :: <android.os.AsyncTask> 
                        (object (<android.os.AsyncTask>)
                                ((doInBackground dib-param :: <java.lang.Object[]>) :: <java.lang.Object>
                                  dib)
                                ((onProgressUpdate opu-param :: <java.lang.Object[]>)
                                  opu))))
       (<android.os.AsyncTask>:execute async-task (apply <java.lang.Object[]> params)))))

which for the example code:

(do-in-background 
 param
 (begin (publishProgress (java.lang.Object[] "test")))
 param
 (begin (<android.util.Log>:d "Test" (param 0)))
 '())

gives the error:

test.scm:235:7: missing method name

Using EXPAND with OBJECTX instead of OBJECT shows that the macro itself
seems to work fine. Could there be some unfortunate interaction between
OBJECT and the macro? 

(expand '(object ()))

shows 

(lambda () #!null)

which to me seems wrong.

Do you have any suggestion what I could do here?


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