From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10844 invoked by alias); 1 Mar 2014 23:06:01 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 10834 invoked by uid 89); 1 Mar 2014 23:06:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: aibo.runbox.com Received: from aibo.runbox.com (HELO aibo.runbox.com) (91.220.196.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sat, 01 Mar 2014 23:06:00 +0000 Received: from [10.9.9.207] (helo=mailfront03.runbox.com) by bars.runbox.com with esmtp (Exim 4.71) (envelope-from ) id 1WJsyi-0001NT-I6; Sun, 02 Mar 2014 00:05:56 +0100 Received: from 70-36-239-203.dsl.dynamic.sonic.net ([70.36.239.203] helo=localhost.localdomain) by mailfront03.runbox.com with esmtpsa (uid:757155 ) (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) id 1WJsyT-00059m-CT; Sun, 02 Mar 2014 00:05:41 +0100 Message-ID: <531267B8.6040407@bothner.com> Date: Sat, 01 Mar 2014 23:06:00 -0000 From: Per Bothner User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Marius Kjeldahl , kawa@sourceware.org Subject: Re: Questions regarding modules References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-q1/txt/msg00083.txt.bz2 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/