emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] * etc/NEWS: Document incompatibilities introduced by record


From: Stefan Monnier
Subject: Re: [PATCH] * etc/NEWS: Document incompatibilities introduced by record types.
Date: Mon, 11 Dec 2017 22:21:34 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> +** The introduction of record types (see below) brings several
> +incompatibilities:
> +*** The return value of 'type-of' is no longer a reliable indicator
> +for the type of an object.  For example, a return value of 'integer'
> +now means that the object in question is either an integer or a record
> +named 'integer'.

No: if someone makes a record of type `integer` he's introduced a bug.

> Don't define record types
> +whose names clash with primitive type names.

Rather than "Don't" I'd say "it's a bug to ...".

> +*** The printed representation of a record named 'hash-table' now
> +clashes with the printed representation of a hash table.  Don't define
> +record types named 'hash-table'.

This is subsumed by the previous "it's a bug to ...".

Clement said:
> Could we just reserve these names and make it an error to define such records?
> Or, could we make type-of return `record-foo` instead of `foo`?

It *is* an error.  Just not one we bother to try and detect because it'd
imply making everyone pay all the time for the rare idiots who'll try to
create such a thing.  There are plenty of ways for a user to shoot
himself in the foot, and we don't bother checking all of them, by a long
stretch: we only check those that have very serious consequences, or
that occur often, or that can be checked at no cost (e.g. it'd be fine to
make `cl-defstruct` reject names like `integer` or `hash-table` since
that's dirt cheap, but it's not a serious enough problem to justify
slowing down `make-record`).


        Stefan




reply via email to

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