[-- Attachment #1: Type: text/plain, Size: 845 bytes --] I've been fiddling with an Android app built with Kawa, and running Kawa, and I've noticed something weird: when I make a "global definition" (in the module containing the definition of Android's activity), then the object bound to a given name is a null - if it's a 'compound object' (like StringBuilder or parameter object, or an object created by define-simple-class). But there are some exceptions: if I use objects such as an integer number or a string, then dereferencing them yields the right values. My bet is that there must be some difference between JVM and Android - and that perhaps I need to initialize something manually in order to have access to the compound objects. Can anyone help? The current source file of my app is here: https://github.com/panicz/grasp-android/blob/master/stages/retreat/GRASP/src/grasp-android.scm
On 10/31/22 03:51, Panicz Maciej Godek via Kawa wrote: > when I make a "global definition" (in the module containing the definition > of Android's activity), then the object bound to a given name is a null - > if it's a 'compound object' (like StringBuilder or parameter object, or an > object created by define-simple-class). But there are some exceptions: if I > use objects such as an integer number or a string, then dereferencing them > yields the right values. Literal and static values can be evaluated and initialized in multiple locations: the class initialize; and object initialized; the "run" method. Where things are initialized may depend on compiler flags (such as --module-static) and what kind of object is being initialized. I don't remember exactly what happens when; it has changed over the years. So it is possible the Android environment may cause some step in the initialization to be skipped or things to be done in the wrong order. -- --Per Bothner per@bothner.com http://per.bothner.com/
[-- Attachment #1: Type: text/plain, Size: 1309 bytes --] Thanks, so far I've figured out that some issues can be resolved by using define-early-constant wherever possible. pon., 31 paź 2022, 17:26 użytkownik Per Bothner <per@bothner.com> napisał: > > > On 10/31/22 03:51, Panicz Maciej Godek via Kawa wrote: > > when I make a "global definition" (in the module containing the > definition > > of Android's activity), then the object bound to a given name is a null - > > if it's a 'compound object' (like StringBuilder or parameter object, or > an > > object created by define-simple-class). But there are some exceptions: > if I > > use objects such as an integer number or a string, then dereferencing > them > > yields the right values. > > Literal and static values can be evaluated and initialized in multiple > locations: the class initialize; and object initialized; the "run" method. > Where things are initialized may depend on compiler flags (such as > --module-static) > and what kind of object is being initialized. I don't remember exactly what > happens when; it has changed over the years. > > So it is possible the Android environment may cause some step in the > initialization > to be skipped or things to be done in the wrong order. > -- > --Per Bothner > per@bothner.com http://per.bothner.com/ >