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: Android REPL on Kawa - unable to create functions on the fly


* teyc [2012-01-28 23:00] writes:

> Helmut Eller-2 wrote:
>> 
>> 
>> (define (msg (fstring string) #!rest args)
>>   (android.util.Log:v "kawa-hello" (apply format fstring args)))
>> 
>> (define-variable *activity* #f)
>> 
>> (define (init-kawa activity)
>>   (kawa.standard.Scheme:registerEnvironment)
>>   (set! gnu.expr.ModuleExp:compilerAvailable #f)
>>   (set! gnu.expr.ModuleExp:alwaysCompile #f)
>>   (set! *activity* activity)
>>   (future (start-repl 4444)))
>> 
>> 
>
> Why is *activity* accessible from REPL but msg isn't?
>
> Is there something special about *activity* compared to msg? 

define-variable creates a "dynamic variable"; dynamic variables are
different from normal top-level variables created with define.  As it
turns out, dynamic variables are visible in all threads.  

I don't know why msg is not accessible; possibly because
registerEnvironment is called too late.

Helmut


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