This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Questions regarding modules
- From: Per Bothner <per at bothner dot com>
- To: Marius Kjeldahl <marius dot kjeldahl at gmail dot com>
- Cc: kawa at sourceware dot org
- Date: Mon, 03 Mar 2014 13:15:46 -0800
- Subject: Re: Questions regarding modules
- Authentication-results: sourceware.org; auth=none
- References: <CAHdMyCJYL=6YJ0oT1pbLdA57kGRCXMRVM1QxyfWar0pzErYsrw at mail dot gmail dot com> <531267B8 dot 6040407 at bothner dot com> <53144610 dot 9040207 at bothner dot com> <CAHdMyCJYH4AnZJS8pKxJ+YOo51DJBOw9a6rJQqwVYv-LxTjPsQ at mail dot gmail dot com> <5314E655 dot 7090809 at bothner dot com> <CAHdMyCL_RtaqPdChwmJVY9bXtU6mP_Lpkv08VNZuh8r0XG9kAQ at mail dot gmail dot com>
On 03/03/2014 12:50 PM, Marius Kjeldahl wrote:
For good reasons I need to control where
the exported symbols appear when requiring the module, not when
defining the individual methods, which is why simply importing all the
defines doesn't cut it.
In that case I suggest using import with either rename or prefix.
For example:
(import (prefix (net kjeldahl kawatest app HelloKawa) kawa-utils-))
...
(kawa-utils-hello)
That's why I'm trying to put it into a class
(I really want a namespace, but who cares).
As I see it, a module *is* a namespace.
However, the docs you've written under the section "How a module
becomes a class" states that using module-name is an alternative to
define-class, and THIS is what I am struggling to get working.
Without resorting to using define-class in HelloKawa.scm, I am not
able to use (net.kjeldahl.kawatest.app.HelloKawa:hello) at all. If
possible, could you show me how I can define the "class" in
HelloKawa.scm with module-name and defining the hello method in it so
that it would be callable with the full name
net.kjeldahl.kawatest.app.HelloKawa:hello from KawaActivity?
Doesn't seem to be working for me either. But since it's sort-of
a backdoor part the module system, that may be ok. Still, I'd like to
understand why it isn't working.
I would be perfectly happy to be told that define-class IS what I need
to use, but based on how I understand the docs, kawa offers a "less
javalike" method of defining "javalike" classes, and that is what I'm
trying to figure out.
Using import seems to make sense. Though import does need some tweaks
- it should probably be extended to support a source filename, as in
require.
--
--Per Bothner
per@bothner.com http://per.bothner.com/