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: Module Import Bindings for Non-Main Classes


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!


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