From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: (:named nil) in cl-defstruct (was: new `obarray` type) Date: Wed, 15 Mar 2017 15:24:32 -0400 Message-ID: References: <20170313220335.GA5098@acm> <20170314201414.GA4562@acm> <8660jaz9lr.fsf@molnjunk.nocrew.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1489605924 6675 195.159.176.226 (15 Mar 2017 19:25:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 15 Mar 2017 19:25:24 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 15 20:25:20 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 1coEXu-00015v-1S for ged-emacs-devel@m.gmane.org; Wed, 15 Mar 2017 20:25:18 +0100 Original-Received: from localhost ([::1]:39186 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coEXz-000863-VQ for ged-emacs-devel@m.gmane.org; Wed, 15 Mar 2017 15:25:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coEXS-00085y-7s for emacs-devel@gnu.org; Wed, 15 Mar 2017 15:24:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1coEXP-00011w-3b for emacs-devel@gnu.org; Wed, 15 Mar 2017 15:24:50 -0400 Original-Received: from [195.159.176.226] (port=48253 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1coEXO-00010j-TF for emacs-devel@gnu.org; Wed, 15 Mar 2017 15:24:47 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1coEXD-0005Wn-FU for emacs-devel@gnu.org; Wed, 15 Mar 2017 20:24:35 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 38 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:PNLQ4u+9APY/1gDpG31jI1eifSA= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 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:213050 Archived-At: >> I can recover some of the speed by adding (:type vector) (:named nil) >> to the defstruct definition. > Does that work for you? It seems to me that (:named nil) does the > opposite of what you would think. Oh, right, indeed. :named works by "present/absent", so you can use (:type vector) :named for "named" and just (:type vector) for "unnamed". Common-Lisp doesn't allow (:named ...), but cl-macs.el treats it as :named hence the confusion. I think we should change this to either disallow (:named ...) or to treat (:named nil) as a way to say "*not* named". The patch below does latter. Any objection? Stefan diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index ee32c3444f..6e95154daa 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2675,7 +2675,7 @@ cl-defstruct ((eq opt :type) (setq type (car args))) ((eq opt :named) - (setq named t)) + (setq named (if args (car args) t))) ((eq opt :initial-offset) (setq descs (nconc (make-list (car args) '(cl-skip-slot)) descs)))