From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailtransmit04.runbox.com (mailtransmit04.runbox.com [IPv6:2a0c:5a00:149::25]) by sourceware.org (Postfix) with ESMTPS id 60494383F862 for ; Fri, 25 Mar 2022 18:46:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 60494383F862 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=bothner.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bothner.com Received: from mailtransmit03.runbox ([10.9.9.163] helo=aibo.runbox.com) by mailtransmit04.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1nXoxN-00EvCW-F6 for kawa@sourceware.org; Fri, 25 Mar 2022 19:46:41 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bothner.com ; s=selector1; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID; bh=3AUNbmL3z18BTYLHwyPjRNjKzTUdERZiNDPep7Z1+ks=; b=DCmm7OQZWGH+XJZhP66IJNKpzi X4FosszS4jI61jKaZ48uvg4syT4cAStpWWTptFl+yJkBkrsspfbJVwFm1hZn2BT96cBvdbWdwiVk4 ZH/d7QsmhfL524CHn/E+FTZKgjq9ahDkdhgPw2JHaz09w6ugRy+AA3Quitxe975q0CSSJNNe/Ew6B jIwqOuAclmwpnS6lir7YDWjvuCBNQNPRh2rvxpLGsKmO8Z5m4BGeZzBm6CMjr19BLLbRT97/Lkvyy 8Mz6357gEbtHzwOozbbTUBqdPUQuCXx3HZuiBvYQhTX7g1UhG7xhLE6b3LCzjK60Xy250E4TGJB3F fu1P5CuQ==; Received: from [10.9.9.72] (helo=submission01.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1nXoxM-0005eR-Tg; Fri, 25 Mar 2022 19:46:41 +0100 Received: by submission01.runbox with esmtpsa [Authenticated ID (524175)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1nXoxG-000223-0W; Fri, 25 Mar 2022 19:46:34 +0100 Message-ID: <8a9b979c-e33d-7e38-9f4c-039092d8169b@bothner.com> Date: Fri, 25 Mar 2022 11:46:29 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: A protected slot is not accessible in a subclass Content-Language: en-US To: Panicz Maciej Godek Cc: kawa@sourceware.org References: <31ee8d16-0229-3c1a-a11d-2402f4fdffce@bothner.com> From: Per Bothner In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: kawa@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Kawa mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Mar 2022 18:46:45 -0000 On 3/25/22 02:59, Panicz Maciej Godek wrote: > I tried this: > (define-simple-class S (gnu.mapping.Symbol) >    ((*init*) >     (invoke-special gnu.mapping.Symbol (this) '*init* (("foo":toString):intern) gnu.mapping.Namespace:EmptyNamespace) >  (set! (field (this) 'name) (("bar":toString):intern)))) > but it gives a similar error: > java.lang.RuntimeException: no such field name in S >         at gnu.kawa.reflect.SlotSet.apply(SlotSet.java:115)                        at gnu.kawa.reflect.SlotSet.apply3(SlotSet.java:120) >         at S.(tty:14) This fails because the (set! (field ...) ...) isn't inlined, so we end up using run-time reflection. This is a missing Kawa optimization. Using set-field! instead does work: (set-field! (this) 'name (("bar":toString):intern)) Note in this case you need to add: (import (kawa reflect)) ; for set-field! I checked in a fix so either of these now work: (set! (this):name (("bar":toString):intern)) (set! name (("bar":toString):intern)) -- --Per Bothner per@bothner.com http://per.bothner.com/