From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: If records are not sequences, why does aref work on records? Date: Sat, 8 Apr 2017 08:24:11 -0400 Message-ID: <7342364e-98f9-87d5-72d2-2f2d46d239f3@gmail.com> References: <86pogo4vty.fsf@molnjunk.nocrew.org> <8360igof0k.fsf@gnu.org> <867f2w4qdk.fsf@molnjunk.nocrew.org> <0e6a0a16-8133-b2bc-404a-d0016f0c655e@cs.ucla.edu> <86h9202knq.fsf@molnjunk.nocrew.org> <4f2a1d4c-8703-4f07-a721-ea28c348631d@default> <864ly02i1m.fsf@molnjunk.nocrew.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1491654309 29314 195.159.176.226 (8 Apr 2017 12:25:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 8 Apr 2017 12:25:09 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 08 14:25:02 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 1cwpQC-0005H7-QL for ged-emacs-devel@m.gmane.org; Sat, 08 Apr 2017 14:24:53 +0200 Original-Received: from localhost ([::1]:54655 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwpQF-0005Mo-68 for ged-emacs-devel@m.gmane.org; Sat, 08 Apr 2017 08:24:55 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwpPd-0005MW-9q for emacs-devel@gnu.org; Sat, 08 Apr 2017 08:24:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwpPZ-0005SE-Io for emacs-devel@gnu.org; Sat, 08 Apr 2017 08:24:17 -0400 Original-Received: from mail-qt0-x231.google.com ([2607:f8b0:400d:c0d::231]:35407) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cwpPZ-0005S4-EK for emacs-devel@gnu.org; Sat, 08 Apr 2017 08:24:13 -0400 Original-Received: by mail-qt0-x231.google.com with SMTP id n46so3460488qta.2 for ; Sat, 08 Apr 2017 05:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=esgeEe4UTxrLlE5rv2UqTUgwus1Q4tSRDolYQMxDJIg=; b=PYA4tPD8wqkgVt9vh1Db/IL1K8IoiRzRNOzuXkaFd4K/p47eCYUCap3Xe4gH5RPjc4 PUFU3+0UPTogt/JDpw0mRKhbdFSuHR0FOfU+1IfCT3Z0fUYHCRFMXQ0xoHBHOa6akb9Z 5C5YmtscWieD9bdJz9m2e5OxAWc0R+LcoQ2QE3VNEvyRzLPVINGYPUhVWwOtZVNh72so HU0MruHl+rtQ9175CBOvqW9YOBYeqvhjXuVyw4TkCqtlz2ssMnSN9BtqeJbbEq0U/0cv 0vZ0V8KoDnlan2uujztBX5nwdnrA/D5qByeZ/rmXfbHzzc/6Sl/PsgIvdnE1clVv6jGx wDsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=esgeEe4UTxrLlE5rv2UqTUgwus1Q4tSRDolYQMxDJIg=; b=eBppOUBL3d2mwBwCYSaO/73aP6rYfhfUuGN+i8vVriPGhCXBufymKuaBXJCZenDGdv MeV+an+9rt8xNU6X2Nq5HVdQolPSrMeJeLb3NFxOeXiD5KKDxKCwXVY/VLjdQ3Y60gRz 6SHl9z7zoOoDcQOLG0BFc7djdlI09X91oorNuM4gtQHees+fNbxh1VCVIJ9+EoO1XHzM 9q1RZlVwCh6CMAbc8J/C1grUbew4ED5Bui2H0EJdZiUenjnTl1zpiPVu5JHMD8NHad3j U7aY06G12suZ8NSKpR69nXzwYYU/pFXM2VJhIw83x6/ZAJImDzsZGwO8sCUhCd2F6wVo 0XJg== X-Gm-Message-State: AFeK/H2iMY6fY3GAXwuXSaeqmXwmacv9EhnRnzLAHg1K/QzhqkMOyZUFTTKXBjhLP9aKrA== X-Received: by 10.237.34.140 with SMTP id p12mr48873546qtc.111.1491654252837; Sat, 08 Apr 2017 05:24:12 -0700 (PDT) Original-Received: from [18.189.26.125] (dhcp-18-189-26-125.dyn.MIT.EDU. [18.189.26.125]) by smtp.gmail.com with ESMTPSA id q145sm4971491qke.39.2017.04.08.05.24.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Apr 2017 05:24:12 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::231 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:213803 Archived-At: On 2017-04-08 07:34, Philipp Stephani wrote: > While the manual mentions that vectors or lists are used, it doesn't > say that the sequence functions can simply be used. It doesn't need to: since vectors and lists are used, it's natural to use vector and list functions on these objects. It goes further: the cl-struct predicates are explicitly *documented* to work fine on vectors: Given any Lisp object X, ‘(person-p X)’ returns true if X looks like a ‘person’, and false otherwise. (Again, in Common Lisp this predicate would be exact; in Emacs Lisp the best it can do is verify that X is a vector of the correct length that starts with the correct tag symbol.) … and the :type predicate says: Vectors are used by default, but ‘(:type list)’ will cause structure objects to be stored as lists instead. … and of course, until the changes discussed here, cl-defstructs were printed just like vectors. > Rather, the implementation as sequence is an implementation detail > that users shouldn't rely on. The manual doesn't say that — I don't think it's fair to call "implementation detail" something that's documented and explicitly not described as an implementation detail: Since the underlying Emacs Lisp system provides no way to create new distinct types, this package implements structures as vectors (or lists upon request) with a special “tag” symbol to identify them. > cl-defstruct even creates a copy-FOO function to copy structures, > which should be used instead of copy-sequence. Therefore, I think > it's fine to not allow copy-sequence and aref on structure types any > more, if this change is properly documented. Please, let's not break perfectly working code gratuitously.