From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: If records are not sequences, why does aref work on records? Date: Sat, 08 Apr 2017 11:34:18 +0000 Message-ID: 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: multipart/alternative; boundary=001a114b74060e8227054ca6201a X-Trace: blaine.gmane.org 1491651288 19624 195.159.176.226 (8 Apr 2017 11:34:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 8 Apr 2017 11:34:48 +0000 (UTC) Cc: Stefan Monnier , Emacs developers To: Noam Postavsky , Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 08 13:34:43 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 1cwoda-0003vq-HP for ged-emacs-devel@m.gmane.org; Sat, 08 Apr 2017 13:34:38 +0200 Original-Received: from localhost ([::1]:54262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwodg-0008Fw-7Z for ged-emacs-devel@m.gmane.org; Sat, 08 Apr 2017 07:34:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwodU-0008Fo-O8 for emacs-devel@gnu.org; Sat, 08 Apr 2017 07:34:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwodT-0005An-FA for emacs-devel@gnu.org; Sat, 08 Apr 2017 07:34:32 -0400 Original-Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]:36951) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cwodT-0005Ai-75 for emacs-devel@gnu.org; Sat, 08 Apr 2017 07:34:31 -0400 Original-Received: by mail-wm0-x230.google.com with SMTP id u2so8229716wmu.0 for ; Sat, 08 Apr 2017 04:34:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HqaL9iEJZrEi3U7zobCK0ePJDB4WX9iPxVaSp3ioBUQ=; b=o5T/glj05QaPQ1FKmt5mtTKlIlj6BBnG1vRqb4E2CtaIOilUJoPeOq/ghLaeZk0bHj 9pepWdq+po0DhTdzszwaD2OyBVXvnSwlKizVFlZ+PWq9QclZaamuLoZfU/meq4CA3g+s DHssnk8v4YaO5fi33VHucfPOjYyTHIRBojhqsI5tanajGFPUfJ+RPYHN54YyIBFBTNaZ WvpR8xiCNnkZNmO1GgJrsClOv+xf8zk+6ZuLh/foMpIapeq5V3xdZRRhqEFFhwZVZ60k kJ0voMW4AsXueRUmp/QtlgwZNzvKBiDDfpfOeSRtxUWcANeu+oGPGAfAh9x0Z49YVNvI CmIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HqaL9iEJZrEi3U7zobCK0ePJDB4WX9iPxVaSp3ioBUQ=; b=aGXHK5/wG2ACa4YrF7a19uYezMHfPsM18n7rHMwzk1ZXK81DhTymRSisk8+/BTIN66 PsT/sRK+qWrR1hj+K4a7KQEfWEH9x2Yea+CdehtIGFZVjTuGnvSA2VPdMBwNSUrTGKdH Np2a2QY/YbIJ/QE+NoDC6P6ePlIZ6JS88eSJdMQyAhPPj0H5hvnaxkdhl1VOVX0c5gmX hs6awMvh7Tzg79nhmu4+/51sMUtS1T3ffIfIPcfW+nA6YFVtqHMaPmX71YKrLH7Mz6hK oFLkk/tS8sx6stbXcMi6MSvi3YQhL9Qhwng26Q2q2f1yb2RIths3WQipYr0tkpx4/A+I iZ6g== X-Gm-Message-State: AN3rC/7ybt2vJl/Znfpp91EDH1kECeK4wzVSGdAy7Hx4rlOIfurcHArwEktX70fsDJoZUNqg9w/kufQJ1nGLjA== X-Received: by 10.28.63.71 with SMTP id m68mr3080580wma.46.1491651269655; Sat, 08 Apr 2017 04:34:29 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::230 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:213802 Archived-At: --001a114b74060e8227054ca6201a Content-Type: text/plain; charset=UTF-8 Noam Postavsky schrieb am Fr., 7. Apr. 2017 um 23:03 Uhr: > On Fri, Apr 7, 2017 at 4:49 PM, Drew Adams wrote: > > > > I don't understand the backward-compatibility argument. > > A record type has not existed before. When/where do we > > already have `aref'/`copy-sequence' being applied to > > something other than a sequence/array? > > Up until the recent changes, the things produced by cl-defstruct > make-foo functions were vectors with the first element being the > symbol 'cl-struct-foo'. So they could be indexed with aref and copied > with copy-sequence. Now they are "record" objects, but we don't want > to break code that uses aref and copy-sequence on them. > > While the manual mentions that vectors or lists are used, it doesn't say that the sequence functions can simply be used. Rather, the implementation as sequence is an implementation detail that users shouldn't rely on. 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. --001a114b74060e8227054ca6201a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Noam P= ostavsky <npostavs@use= rs.sourceforge.net> schrieb am Fr., 7. Apr. 2017 um 23:03=C2=A0Uhr:<= br>
On Fri, Apr 7, 2017 at 4:49 PM, Dre= w Adams <drew.adams@oracle.com> wrote:
>
> I don't understand the backward-compatibility argument.
> A record type has not existed before.=C2=A0 When/where do we
> already have `aref'/`copy-sequence' being applied to
> something other than a sequence/array?

Up until the recent changes, the things produced by cl-defstruct
make-foo functions were vectors with the first element being the
symbol 'cl-struct-foo'. So they could be indexed with aref and copi= ed
with copy-sequence. Now they are "record" objects, but we don'= ;t want
to break code that uses aref and copy-sequence on them.


While the manual m= entions that vectors or lists are used, it doesn't say that the sequenc= e functions can simply be used. Rather, the implementation as sequence is a= n implementation detail that users shouldn't rely on. cl-defstruct even= creates a copy-FOO function to copy structures, which should be used inste= ad of copy-sequence. Therefore, I think it's fine to not allow copy-seq= uence and aref on structure types any more, if this change is properly docu= mented.=C2=A0
--001a114b74060e8227054ca6201a--