[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: If records are not sequences, why does aref work on records?
From: |
Lars Brinkhoff |
Subject: |
Re: If records are not sequences, why does aref work on records? |
Date: |
Fri, 07 Apr 2017 19:27:05 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
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.
- Re: Recent change in master breaks async package update using paradox, (continued)
- Re: Recent change in master breaks async package update using paradox, Lars Brinkhoff, 2017/04/07
- Re: Recent change in master breaks async package update using paradox, Eli Zaretskii, 2017/04/07
- Debugging problems using async.el, Lars Brinkhoff, 2017/04/07
- Re: Debugging problems using async.el, Kaushal Modi, 2017/04/07
- Re: Debugging problems using async.el, Eli Zaretskii, 2017/04/07
- Re: Debugging problems using async.el, Lars Brinkhoff, 2017/04/07
- Re: Recent change in master breaks async package update using paradox, Stefan Monnier, 2017/04/07
- What is a "sequence"?, Lars Brinkhoff, 2017/04/07
- Re: What is a "sequence"?, Stefan Monnier, 2017/04/07
- If records are not sequences, why does aref work on records?, Paul Eggert, 2017/04/07
- Re: If records are not sequences, why does aref work on records?,
Lars Brinkhoff <=
- RE: If records are not sequences, why does aref work on records?, Drew Adams, 2017/04/07
- Re: If records are not sequences, why does aref work on records?, Lars Brinkhoff, 2017/04/07
- RE: If records are not sequences, why does aref work on records?, Drew Adams, 2017/04/07
- Re: If records are not sequences, why does aref work on records?, Noam Postavsky, 2017/04/07
- Re: If records are not sequences, why does aref work on records?, Stefan Monnier, 2017/04/07
- RE: If records are not sequences, why does aref work on records?, Drew Adams, 2017/04/07
- Re: If records are not sequences, why does aref work on records?, Clément Pit-Claudel, 2017/04/07
- Re: If records are not sequences, why does aref work on records?, Noam Postavsky, 2017/04/07
- Re: If records are not sequences, why does aref work on records?, Paul Eggert, 2017/04/07
- Re: If records are not sequences, why does aref work on records?, Lars Brinkhoff, 2017/04/08