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: Questions regarding modules


On 03/03/2014 01:23 AM, Marius Kjeldahl wrote:
If it's a bug than certainly explains my struggles.

I can confirm that the import statement does not trigger the error
that the similar require statement does. However I am still unable to
access the "hello" function from KawaHello (when using the
module-name/define pattern) using net.kjeldahl.kawatest.app.KawaHello.
The same "no known slot hello in java.lang.Object" warning gets
triggered.

Replace:
  (HelloKawa:hello)
by plain:
  (hello)
or:
  (net.kjeldahl.kawatest.app.HelloKawa:hello)

Remember what I wrote March 1:

  When you (require MODULE) what happens is that all the public (exported)
  names in MODULE are added to the current lexical scope.

If you write:

(module-name net.kjeldahl.kawatest.app.HelloKawa)
(define (hello)
   "Hello from Kawa!")

then HelloKawa is *not* a public exported name in the module,
so it is *not* in scope in KawaActivity (or in HelloKawa).

Kawa's default binding mechanism does add bindings for all
fully-qualified class names that exist in the classpath.
The is why you can write things like (java.util.ArrayList).
The binding is a default (fall-back), so it only triggers only
if there is no binding in the lexical scope.

However, HelloKawa is not a fully-qualified class name.  For that
you have to write:
   (net.kjeldahl.kawatest.app.HelloKawa:hello)

Best is to write plain:
  (hello)
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


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