From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74429 invoked by alias); 30 Mar 2015 07:06:08 -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 74414 invoked by uid 89); 30 Mar 2015 07:06:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,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; Mon, 30 Mar 2015 07:06:06 +0000 Received: from [10.9.9.206] (helo=mailfront02.runbox.com) by bars.runbox.com with esmtp (Exim 4.71) (envelope-from ) id 1YcTlq-00060k-0p; Mon, 30 Mar 2015 09:06:02 +0200 Received: from 70-36-239-115.dsl.dynamic.fusionbroadband.com ([70.36.239.115] helo=toshie.bothner.com) by mailfront02.runbox.com with esmtpsa (uid:757155 ) (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.76) id 1YcTkn-0006tn-Uk; Mon, 30 Mar 2015 09:04:58 +0200 Message-ID: <5518F594.3020007@bothner.com> Date: Mon, 30 Mar 2015 07:06:00 -0000 From: Per Bothner User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Jeff Gonis , kawa@sourceware.org Subject: Re: Using the Unit Test Srfi from inside a library definition References: <1427683182.1505632.246832417.63BAB697@webmail.messagingengine.com> In-Reply-To: <1427683182.1505632.246832417.63BAB697@webmail.messagingengine.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-q1/txt/msg00070.txt.bz2 On 03/29/2015 07:39 PM, Jeff Gonis wrote: > However if I try to define my test inside a define-library form I get > the following error message: > /dev/stdin:79:7: improper list (circular or dotted) is not allowed here > > The minimal library example is as follows: > (define-library (testlib) > (export test-suite) > (import (scheme base) > (srfi 64)) > (begin > (define (test-suite) > (test-begin "temp") > (test-end "temp")))) > > As far as I can tell, there shouldn't be any difference here, > except that the test-begin and end are define inside a library. I checked in a fix for this - it should work now. The issue is that the default Kawa top-level environment has a number of predefined bindings, while the body of a define-library only has the bindings you explicitly import. The problem is when testing.scm (i.e. he implementation of srfi 64) is compiled. Any bindings that are not explicitly imported are resolved in the default Kawa top-level, which normally works fine. Consider a macro that expands to a form that references various standard Scheme forms. If the bindings haven't been hygienically imported when compiling testing.scm, then the Kawa compiler will normally look for bindings in the default top-level environment dynamic environment - which is disabled when processing the body of a define-library. The particular error message you saw is because the binding for quote is missing, so Kawa processes quote as if it were a call to an unknown function. The fix is (basically) to (import (scheme base)) when compiling testing.scm. This provides hygienic bindings for names used in expanded macros. (It was a little more complicated than that, mainly because test-begin is magic in the default top-level, causing an auto-import.) > I may have missed something incredibly simple though and if so my apologies > for taking up your time. Nope, it was a Kawa bug that needed to be fixed. Thanks for the simple test-case. A lot of these errors were fixed last year (largely thanks to testing by Seth Alves), but there are probably more remaining. -- --Per Bothner per@bothner.com http://per.bothner.com/