This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Android REPL - add* syntax-sugar not available in constructor
- From: Per Bothner <per at bothner dot com>
- To: teyc <teyc at cognoware dot com>
- Cc: kawa at sourceware dot org
- Date: Sun, 29 Jan 2012 00:40:38 -0800
- Subject: Re: Android REPL - add* syntax-sugar not available in constructor
- References: <33222365.post@talk.nabble.com>
On 01/28/2012 05:11 PM, teyc wrote:
I'm starting to have fun with the REPL Helmut provided.
I haven't quite gotten it to work. I can compile, install,
and run it - but then what? I assume I can connect using telnet
- but the messages don't show up with adb logcat, so I don't
know how to connect. (I've only tried connecting using the
emulator. I can try using a phone if that may make a difference.)
Unfortunately, the REPL running under Android doesn't recognize the
"addView" in the constructor.
#|kawa:319|#
(android.widget.LinearLayout *activity*
orientation: android.widget.LinearLayout:VERTICAL
view:
(android.widget.TextView *activity*
text: "Hello, Android REPL from Kawa Scheme!"))
java.lang.RuntimeException: no such field view in
android.widget.LinearLayout
at gnu.kawa.reflect.SlotSet.apply(SlotSet.java:115)
at gnu.kawa.reflect.Invoke.applyN(Invoke.java:239)
at gnu.kawa.reflect.Invoke.apply(Invoke.java:99)
Invoke.applyN is used to "apply" the constructor, when the compiler
can't inline it. And Invoke.applyN clearly doesn't handle "addXxx".
That is one bug - in principle not difficult to fix.
But what is puzzling is why Invoke.applyN is called at runtime.
The "pre-compiler" is supposed to call CompileInvoke#validateApplyInvoke
- and this should be called by eval, when if the bytecode compiler
is unavailable. Mapping "xxx:" to "addXxx" is supposed to be handled
by the CompiledBuildObject#findNamedMember and #buildSetter methods.
From looking at the code I haven't seem why that is not happening.
(If I can get the repl working I can hopefully add println etc.)
--
--Per Bothner
per@bothner.com http://per.bothner.com/