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: Re: User-defined record types Date: Tue, 14 Mar 2017 11:20:56 -0400 Message-ID: References: <87pokampa4.fsf@ericabrahamsen.net> <8760m2mmlq.fsf@ericabrahamsen.net> <87lguq5r87.fsf@ericabrahamsen.net> <878tp0i74g.fsf@users.sourceforge.net> <87efyg6y0i.fsf_-_@drachen> <87zigwz9wx.fsf@tromey.com> <86bmtbd45s.fsf@molnjunk.nocrew.org> <86bmt42nk2.fsf_-_@molnjunk.nocrew.org> <86o9x40z35.fsf@molnjunk.nocrew.org> <86k27s0w6m.fsf@molnjunk.nocrew.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1489504929 29066 195.159.176.226 (14 Mar 2017 15:22:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 14 Mar 2017 15:22:09 +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 Tue Mar 14 16:22:04 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 1cnoGo-0006CE-Rm for ged-emacs-devel@m.gmane.org; Tue, 14 Mar 2017 16:21:54 +0100 Original-Received: from localhost ([::1]:60075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnoGt-0004Gr-CI for ged-emacs-devel@m.gmane.org; Tue, 14 Mar 2017 11:21:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnoGL-0004Gi-6x for emacs-devel@gnu.org; Tue, 14 Mar 2017 11:21:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnoGH-0001vP-8N for emacs-devel@gnu.org; Tue, 14 Mar 2017 11:21:25 -0400 Original-Received: from [195.159.176.226] (port=36973 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnoGH-0001uO-1H for emacs-devel@gnu.org; Tue, 14 Mar 2017 11:21:21 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cnoFv-0001Rg-3D for emacs-devel@gnu.org; Tue, 14 Mar 2017 16:20:59 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 26 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:rOgwBUZMCCGbq+TRWC7RzU+ovss= 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:213021 Archived-At: >> If you pass (:named foo) to cl-defstruct, foo will be put in list or >> vector slot 0, so I suppose that should work for records too. >> If you don't use the :named option, it seems there will be no type >> information in the instances. > I see now this is wrong, and there are more cases to consider. > This is the situation as of now: > - If you don't pass the :type option to cl-defstruct, you get a > cl-struct-FOO type tag in slot 0. That's right. And this symbol's value is the class object. The same holds for EIEIO. These are the main candidates for use of the new `record` type. > - If you pass :type but not :named, you don't get any type tag. And those should not use `record` but `vector` or `list` depending on the :type that was specified. > - If you pass :type and :named, you get a type tag in slot 0, which is > the same symbol as the struct name. But again, these shouldn't use `record`. Stefan