From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 110082 invoked by alias); 24 Sep 2017 21:52:53 -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 109384 invoked by uid 89); 24 Sep 2017 21:52:53 -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 spammy=Hx-languages-length:1495, Hope 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 ESMTP; Sun, 24 Sep 2017 21:52:51 +0000 Received: from [10.9.9.212] (helo=mailfront12.runbox.com) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1dwEpT-0005FG-Oo; Sun, 24 Sep 2017 23:52:47 +0200 Received: from 70-36-239-2.dsl.dynamic.fusionbroadband.com ([70.36.239.2] helo=localhost.localdomain) by mailfront12.runbox.com with esmtpsa (uid:757155 ) (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) id 1dwEpR-0006Rn-Sk; Sun, 24 Sep 2017 23:52:46 +0200 Subject: Re: no class-of ? To: Jamison Hope , Kawa mailing list References: <425B3BC8-31F3-4299-ADB1-9E064C1E8D3E@theptrgroup.com> <51a642b1-f20d-9f32-645d-ea96b935e3c2@bothner.com> <332863a5-3fdf-147e-e9c8-23253b0eff31@bothner.com> From: Per Bothner Message-ID: Date: Sun, 24 Sep 2017 21:52:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-q3/txt/msg00080.txt.bz2 On 09/23/2017 07:31 AM, Jamison Hope wrote: > But I get a java.lang.Error when I try to compile that: > > > (compiling test.scm to test) > Exception in thread "main" java.lang.Error: gnu.kawa.lispexpr.LangPrimType does not implement Externalizable > at gnu.expr.LitTable.error(LitTable.java:122) > ... The problem is the 'boolean' has language-specific semantics, so the variable 'boolean' is bound to the field kawa.standard.Scheme.booleanType. However, the *class* of boolean is a gnu.kawa.lispexpr.LangPrimType, because of this mismatch, the Kawa compiler doesn't find it when it needs to compile boolean as a literal. One could "fix" LangPrimType to implement Externalizable, but that would create a new object, different from Scheme.booleanType. A solution would be to create a new subclass SchemePrimType, and do: public static final LangPrimType booleanType = SchemePrimType,booleanType; Instead, I implemented a somewhat more general mechanism: If an object that needs to be referenced as a literal implements HasOwningField, we use the getOwningField of that interface to find the corresponding static field. > If I change the test to "(eq? t0 integer)" or "(eq? t0 byte)", then it > compiles without error, so it's something about boolean in particular. Yes, integer is bound to LangPrimType.intType. Since the code for compiling literals looks for the class of the value, it can easily find the field. -- --Per Bothner per@bothner.com http://per.bothner.com/