* type-of semantics unclear for records
@ 2017-04-04 22:12 Paul Eggert
2017-04-05 1:10 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Paul Eggert @ 2017-04-04 22:12 UTC (permalink / raw
To: Emacs development discussions
The recently-changed behavior of 'type-of' causes it to disagree with
its documentation when the type of a record is itself a record. For
example, the documentation implies that (eq X (type-of (record X)))
should be t for all X, but this is not the case when X is (record 'a
'b), because in this case (type-of (record X)) returns b.
I assume the behavior is intended to support subclassing of some sort;
if so the subclassing should be documented (or at least the doc should
say that behavior is undefined if the record type is not a symbol), and
if not the behavior should be changed to agree with the doc.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: type-of semantics unclear for records
2017-04-04 22:12 type-of semantics unclear for records Paul Eggert
@ 2017-04-05 1:10 ` Stefan Monnier
2017-04-05 1:45 ` Paul Eggert
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2017-04-05 1:10 UTC (permalink / raw
To: emacs-devel
> I assume the behavior is intended to support subclassing of some sort; if so
No, it's just that the first field can be a type name (a symbol) or
a type descriptor (a record, where the first field holds the
corresponding type name).
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: type-of semantics unclear for records
2017-04-05 1:10 ` Stefan Monnier
@ 2017-04-05 1:45 ` Paul Eggert
2017-04-05 5:24 ` Lars Brinkhoff
2017-04-05 14:10 ` Stefan Monnier
0 siblings, 2 replies; 8+ messages in thread
From: Paul Eggert @ 2017-04-05 1:45 UTC (permalink / raw
To: Stefan Monnier, emacs-devel
On 04/04/2017 06:10 PM, Stefan Monnier wrote:
> the first field can be a type name (a symbol) or
> a type descriptor (a record, where the first field holds the
> corresponding type name).
Ah, I'm afraid I don't know how type descriptors are supposed to work in
Emacs. I don't offhand see the concept mentioned in the documentation;
shouldn't it be?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: type-of semantics unclear for records
2017-04-05 1:45 ` Paul Eggert
@ 2017-04-05 5:24 ` Lars Brinkhoff
2017-04-05 6:51 ` Lars Brinkhoff
2017-04-05 14:10 ` Stefan Monnier
1 sibling, 1 reply; 8+ messages in thread
From: Lars Brinkhoff @ 2017-04-05 5:24 UTC (permalink / raw
To: emacs-devel
Paul Eggert wrote:
> Stefan Monnier wrote:
>> the first field can be a type name (a symbol) or a type descriptor (a
>> record, where the first field holds the corresponding type name).
> Ah, I'm afraid I don't know how type descriptors are supposed to work
> in Emacs. I don't offhand see the concept mentioned in the
> documentation; shouldn't it be?
I don't know for sure either, but it seems to be an EIEIO metaobject
thing. So a type descriptor would be an instance of eieio--class.
I agree that the record type semantics should be documented. The
type-of docstring says to return a symbol representing the type, so
that's good I think. But I can insert a passage or two in the Lisp
manual.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: type-of semantics unclear for records
2017-04-05 5:24 ` Lars Brinkhoff
@ 2017-04-05 6:51 ` Lars Brinkhoff
0 siblings, 0 replies; 8+ messages in thread
From: Lars Brinkhoff @ 2017-04-05 6:51 UTC (permalink / raw
To: emacs-devel
> Paul Eggert wrote:
>> Ah, I'm afraid I don't know how type descriptors are supposed to work
>> in Emacs. I don't offhand see the concept mentioned in the
>> documentation; shouldn't it be?
>
> I agree that the record type semantics should be documented. The
> type-of docstring says to return a symbol representing the type, so
> that's good I think. But I can insert a passage or two in the Lisp
> manual.
Please review the new commit in scratch/record.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: type-of semantics unclear for records
2017-04-05 1:45 ` Paul Eggert
2017-04-05 5:24 ` Lars Brinkhoff
@ 2017-04-05 14:10 ` Stefan Monnier
2017-04-06 7:40 ` Lars Brinkhoff
1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2017-04-05 14:10 UTC (permalink / raw
To: Paul Eggert; +Cc: emacs-devel
> Ah, I'm afraid I don't know how type descriptors are supposed to work in
> Emacs.
IIRC from core-Elisp's point of view they exist only here in `type-of`
and are defined as "a record whose field 1 is the corresponding type
name (a symbol)".
> I don't offhand see the concept mentioned in the documentation;
> shouldn't it be?
Indeed, `make-record`s doctring should probably say something about it.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: type-of semantics unclear for records
2017-04-05 14:10 ` Stefan Monnier
@ 2017-04-06 7:40 ` Lars Brinkhoff
2017-04-06 12:59 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Lars Brinkhoff @ 2017-04-06 7:40 UTC (permalink / raw
To: emacs-devel
Stefan Monnier wrote:
>> I don't offhand see the concept mentioned in the documentation;
>> shouldn't it be?
> Indeed, `make-record`s doctring should probably say something about it.
I updated the `record' and `make-record' docstrings to mention type
descriptors. I'm not sure if the entire description of type descriptors
should be copied there as well. It could be a bit unwieldy.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: type-of semantics unclear for records
2017-04-06 7:40 ` Lars Brinkhoff
@ 2017-04-06 12:59 ` Stefan Monnier
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2017-04-06 12:59 UTC (permalink / raw
To: emacs-devel
> I updated the `record' and `make-record' docstrings to mention type
> descriptors.
Thanks.
> I'm not sure if the entire description of type descriptors
> should be copied there as well.
Doesn't seem necessary. Such "general" definitions are better placed in
the Elisp manual.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-04-06 12:59 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-04 22:12 type-of semantics unclear for records Paul Eggert
2017-04-05 1:10 ` Stefan Monnier
2017-04-05 1:45 ` Paul Eggert
2017-04-05 5:24 ` Lars Brinkhoff
2017-04-05 6:51 ` Lars Brinkhoff
2017-04-05 14:10 ` Stefan Monnier
2017-04-06 7:40 ` Lars Brinkhoff
2017-04-06 12:59 ` Stefan Monnier
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.