emacs-devel
[Top][All Lists]
Advanced

[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: Noam Postavsky
Subject: Re: If records are not sequences, why does aref work on records?
Date: Fri, 7 Apr 2017 15:07:31 -0400

On Fri, Apr 7, 2017 at 2:30 PM, Drew Adams <address@hidden> wrote:
>>
>> So what do you think about the byte-code type, which supports many, but
>> not all, sequence operations?  Is that a long-standing bug?
>
> I know nothing about it; sorry.  If it is then it is.
>
> Emacs, like Common Lisp, should have a well-defined sequence
> type.  We aren't required to model ours on CL's, but other
> things being equal it wouldn't be a bad idea to look to CL
> for guidance/inspiration.

AFAIK, CL's structures (if defined without a :type argument) are not
sequences, and I don't see any need for Elisp's to be either.

To quote the elisp manual: "The common property that all sequences
have is that each
is an ordered collection of elements." A record's elements are more
like an unordered set. If you do (cl-defstruct person age height), you
don't care whether 'age' goes before 'height', just that person-age
gives you the age field. And some sequence operations make no sense on
records: e.g., doing 'sort' or 'reverse' on a record would not result
in a valid record.

If we decide to support aref or copy-sequence on records for
efficiency or backwards compatibility that doesn't mean we want them
to be full sequences.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]