From: Per Bothner <per@bothner.com>
To: Marius Kjeldahl <marius.kjeldahl@gmail.com>, kawa@sourceware.org
Subject: Re: Questions regarding modules
Date: Sat, 01 Mar 2014 23:06:00 -0000 [thread overview]
Message-ID: <531267B8.6040407@bothner.com> (raw)
In-Reply-To: <CAHdMyCJYL=6YJ0oT1pbLdA57kGRCXMRVM1QxyfWar0pzErYsrw@mail.gmail.com>
On 03/01/2014 07:52 AM, Marius Kjeldahl wrote:
> Question 1 - The line that does require HelloKawa; Unless I list the
> filename "HelloKawa.scm" as the second parameter, I will get a kawa
> compiler error; invalid specifier for 'require'. I have no idea why.
> I've experienced with setting the working dir prior to calling the
> kawa compiler, but it does not seem to matter much. It looks like kawa
> has it's own idea about the proper path for start searching for the
> source file for the module.
IIRC the filename "HelloKawa.scm" is needed in a require if
the file is not already-compiled *and* it is not currently being
compiled (i.e. on the kawa -C command line).
This may change if/when we implement R7RS define-library, or
we implement some kind of Scheme packaging mechanism, as has been discussed.
> Question 2 - When invoking (HelloKawa:hello), how come kawa knows
> about my HelloKawa class without the full class name? I haven't done
> any define-alias on it, so it's a bit unexpected.
When you (require MODULE) what happens is that all the public (exported)
names in MODULE are added to the current lexical scope. The class HelloKawa
is a public exported Scheme name in the HelloKawa module - since they happen
to have the same name - and they happen to get compiled to the same class.
A (define-simple-class HelloKawa () ...) creates a definition of the
identifier HelloKawa in the current Scheme scope - and that binding
is by default exported. This action is in addition and distinct from
the action of create a JCM class net.kjeldahl.kawatest.app.HelloKawa.
Conceptually the "module class" net.kjeldahl.kawatest.app.HelloKawa
is different from the define-simple-class HelloKawa. They're just
implemented using a single class, with module-level functionality being
static, and define-simple-class-level stuff being (usually) non-static.
> Question 3 - The file defining HelloKawa uses define-simple-class, but
> I've also tried it with a straight up define instead (you'll see that
> commented out in the source file above). If I do that, I get two
> errors from kawa; no known slot hello in java.lang.Object, and no
> declaration seen for HelloKawa.
Hopefully the previous answers will explain this.
>Based on what I've read, this second
> method of defining a module should work as long as we stay within the
> kawa domain, but I may have interpreted that wrong.
There is no special magic for the "kawa" domain. They is some special
magic for "kawa.lib" when using R7RS-style import.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
next prev parent reply other threads:[~2014-03-01 23:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-01 15:52 Marius Kjeldahl
2014-03-01 22:30 ` Marius Kjeldahl
2014-03-01 23:06 ` Per Bothner [this message]
2014-03-03 9:06 ` Per Bothner
2014-03-03 9:23 ` Marius Kjeldahl
2014-03-03 20:30 ` Per Bothner
2014-03-03 20:50 ` Marius Kjeldahl
2014-03-03 21:15 ` Per Bothner
[not found] ` <CAHdMyCKEqZXfpqTL-AX5q+XAQNq3cChoYFa0aDDVet+_PX_2og@mail.gmail.com>
2014-03-03 21:42 ` Fwd: " Marius Kjeldahl
2014-03-04 9:10 ` Per Bothner
2014-03-04 9:55 ` Marius Kjeldahl
2014-03-04 17:23 ` Per Bothner
2014-03-04 18:26 ` Marius Kjeldahl
2014-03-04 18:48 ` Per Bothner
2014-03-04 18:58 ` Marius Kjeldahl
2014-03-04 20:16 ` Per Bothner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=531267B8.6040407@bothner.com \
--to=per@bothner.com \
--cc=kawa@sourceware.org \
--cc=marius.kjeldahl@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).