all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Brinkhoff <lars@nocrew.org>
To: emacs-devel@gnu.org
Subject: Re: If records are not sequences, why does aref work on records?
Date: Fri, 07 Apr 2017 19:27:05 +0200	[thread overview]
Message-ID: <86h9202knq.fsf@molnjunk.nocrew.org> (raw)
In-Reply-To: 0e6a0a16-8133-b2bc-404a-d0016f0c655e@cs.ucla.edu

Paul Eggert wrote:
>> I think there are only a few functions that wants a sequence but not a
>> record: elt, copy-sequence, concat, reverse, and sort.
>
> It is confusing that aref works on records but copy-sequence etc. do
> not. This behavior of aref is not documented in the aref doc string,
> or in the Lisp manual under aref.

You're right.  I can add that documentation, if that's indeed the way
we want to go.

> How about if we define a new function record-ref to be used on
> records, instead of aref? At the low level this would insulate records
> better from the rest of Emacs Lisp, which I think is the intent -- as
> I understand it, records are supposed to be used to create new types,
> and are not supposed to be sorts of aliases for sequences.

That's one way to go, and I understand that point of view.

I believe there is prior art in XEmacs.  They added special functions to
work with byte-code slots, and removed access with aref.  I don't know
the background, but I note that GNU Emacs never followed suit.

The other point of view might be that aref is already there, works fine
for arrays, byte-code, and other pseudovector types, so it might just as
well be extended to work with records too.  Add to this that old code
using aref on vector structures will keep working if passed a record
structure.

To answer the question in the subject, I initially patterned records
mostly after the byte-code type because they are quite alike.  So that
included using aref to access slots.




  reply	other threads:[~2017-04-07 17:27 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05 15:31 Recent change in master breaks async package update using paradox Kaushal Modi
2017-04-05 16:05 ` Eli Zaretskii
2017-04-05 21:59 ` Tom Tromey
2017-04-05 22:48   ` Kaushal Modi
2017-04-06  5:00     ` Lars Brinkhoff
2017-04-06 10:46       ` Kaushal Modi
2017-04-06 11:00         ` Lars Brinkhoff
2017-04-06 11:28           ` Kaushal Modi
2017-04-06 12:12             ` Lars Brinkhoff
2017-04-06 12:22               ` Noam Postavsky
2017-04-06 12:36                 ` Lars Brinkhoff
2017-04-06 11:19 ` Lars Brinkhoff
2017-04-07  5:42 ` Lars Brinkhoff
2017-04-07  7:25   ` Eli Zaretskii
2017-04-07  7:40     ` Lars Brinkhoff
2017-04-07  9:51       ` Eli Zaretskii
2017-04-07 13:28         ` Debugging problems using async.el Lars Brinkhoff
2017-04-07 14:11           ` Kaushal Modi
2017-04-07 14:39             ` Eli Zaretskii
2017-04-07 18:10             ` Lars Brinkhoff
2017-04-07 11:59       ` Recent change in master breaks async package update using paradox Stefan Monnier
2017-04-07 13:07         ` What is a "sequence"? Lars Brinkhoff
2017-04-07 13:26           ` Stefan Monnier
2017-04-07 16:56       ` If records are not sequences, why does aref work on records? Paul Eggert
2017-04-07 17:27         ` Lars Brinkhoff [this message]
2017-04-07 17:41           ` Drew Adams
2017-04-07 18:23             ` Lars Brinkhoff
2017-04-07 18:30               ` Drew Adams
2017-04-07 19:07                 ` Noam Postavsky
2017-04-07 19:13                   ` Stefan Monnier
2017-04-07 20:49                     ` Drew Adams
2017-04-07 21:00                       ` Clément Pit-Claudel
2017-04-07 21:02                       ` Noam Postavsky
2017-04-08  1:58                         ` Paul Eggert
2017-04-08  5:03                           ` Lars Brinkhoff
2017-04-08  5:25                             ` Lars Brinkhoff
2017-04-08  5:34                           ` Noam Postavsky
2017-04-08  7:42                             ` Paul Eggert
2017-04-08  7:50                               ` Eli Zaretskii
2017-04-08 13:33                               ` Noam Postavsky
2017-04-08 11:34                         ` Philipp Stephani
2017-04-08 12:24                           ` Clément Pit-Claudel
2017-04-08 15:24                             ` Lars Brinkhoff
2017-04-08 17:17                               ` Clément Pit-Claudel
2017-04-08 17:46                                 ` Lars Brinkhoff
2017-04-09 19:15                             ` Richard Stallman
2017-04-11 12:27                               ` Stefan Monnier
2017-04-07 19:25                   ` Clément Pit-Claudel
2017-04-07 19:41                     ` Noam Postavsky
2017-04-07 20:12                       ` Clément Pit-Claudel
2017-04-07 19:43                     ` Stefan Monnier
2017-04-07 17:59         ` Clément Pit-Claudel
2017-04-07 18:28 ` Recent change in master breaks async package update using paradox Lars Brinkhoff
2017-04-08  6:50   ` Lars Brinkhoff
2017-04-08 12:25     ` Clément Pit-Claudel
2017-04-08 13:35     ` Kaushal Modi
2017-04-08 18:21       ` Lars Brinkhoff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86h9202knq.fsf@molnjunk.nocrew.org \
    --to=lars@nocrew.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.