Module Import Bindings for Non-Main Classes
Taylor Venable
venablet@ipfw.edu
Wed Oct 26 20:00:00 GMT 2011
On 10/26/2011 03:44 PM, Per Bothner wrote:
> On 10/26/2011 12:22 PM, Taylor Venable wrote:
>> Thanks, I was reading that page but not looking in the right place. It
>> also says: "If 'init-run is specified, in addition the module body is
>> evaluated in the class's static initializer. (Otherwise, it is run the
>> first time it is require'd.)" That makes me think that the following
>> modification alone should work (that is, without using the init-run in
>> alpha.scm), but it does not:
>>
>> (module-name "com.example.Beta")
>>
>> (require com.example.Alpha)
>>
>> (define (test)
>> (display test-a) (newline)
>> (display test-b) (newline)
>> (display test-c) (newline))
>
> require and import are equivalent - both cause the imported module's
> initializer (including the body) to be run.
>
> The problem is gamma. It does not use either import or require,
> so it just runs the Beta:test method *without insuring that Beta
> has been initialized* - which means that Alpha hasn't been initialized
> either.
Oh, I feel quite silly now for not seeing that. :-)
Again, thank you. And thanks for Kawa!
More information about the Kawa
mailing list