Android REPL - add* syntax-sugar not available in constructor
Per Bothner
per@bothner.com
Sun Jan 29 08:42:00 GMT 2012
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/
More information about the Kawa
mailing list