From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: David Engster Newsgroups: gmane.emacs.devel Subject: Re: Fixing "Unknown slot" warnings Date: Sun, 29 Jan 2017 16:35:19 +0100 Message-ID: <87o9ypnako.fsf@engster.org> References: <87sho2m458.fsf@engster.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1485704180 10732 195.159.176.226 (29 Jan 2017 15:36:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 29 Jan 2017 15:36:20 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 29 16:36:15 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cXrWK-0000vw-6k for ged-emacs-devel@m.gmane.org; Sun, 29 Jan 2017 16:36:00 +0100 Original-Received: from localhost ([::1]:55740 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXrWO-0008Cs-0c for ged-emacs-devel@m.gmane.org; Sun, 29 Jan 2017 10:36:04 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXrVp-0008Cm-Ck for emacs-devel@gnu.org; Sun, 29 Jan 2017 10:35:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXrVm-0002ea-5j for emacs-devel@gnu.org; Sun, 29 Jan 2017 10:35:29 -0500 Original-Received: from randomsample.de ([5.45.97.173]:50631) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cXrVl-0002eK-SG for emacs-devel@gnu.org; Sun, 29 Jan 2017 10:35:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=randomsample.de; s=a; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From; bh=r0nRKfNi+fdnO8gcmV6vsaINJ02ZHtihNUuLgV0hsxA=; b=LmVumoMFOiYBngwsNqmgILniPEqFKq0NQ8zuQiYwlcqa7UaOsQkeP9h7RxS9MGzPsHrb2zdLSNzs5a0RQjl4wl6bmVlMjolL91fpL6yAMc0xObTZw6HaWxCpJbQ7cMuJ; Original-Received: from ip4d16b353.dynamic.kabel-deutschland.de ([77.22.179.83] helo=isaac) by randomsample.de with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1cXrVi-0006QC-Ox; Sun, 29 Jan 2017 16:35:22 +0100 In-Reply-To: (Stefan Monnier's message of "Sun, 29 Jan 2017 09:41:18 -0500") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 5.45.97.173 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:211724 Archived-At: Stefan Monnier writes: >> How can I tell the compiler everything will be OK at runtime, similar to >> what 'declare-function' does for functions? > > I don't think we have something for that right now. > Maybe you can try something like: > > (eval-when-compile (defclass dummy () ((SLOT)))) > > Better would be to wrap this into an `eieio-declare-slot` macro (which > could later be replaced by something which doesn't end up defining > a class as a side-effect). After looking at the code, it seems all slot symbols are shoved into `eieio--known-slot-names' and the byte-compiler checks if a slot is in there, regardless of the class being used. So the following would already do the trick: (defmacro eieio-declare-slot (name) "Declares slot to be available at runtime." `(eval-when-compile (cl-pushnew ,name eieio--known-slot-names))) -David