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: Wed, 13 Dec 2017 11:30:38 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>>> If programmers are not supposed to do it, let's detect it and report
>>> an error when they try.  That way, they will know it's an error as
>>> soon as they try, rather than needing to debug it to find out it's an error.
>> When was the last time you saw a user try to redefine the
>> "integer" type?
>> [ I'll be happy to hear about cases in other languages than Elisp,
>> since otherwise it's going to be depressingly silent I'm afraid.  ]
> What's so special about "integer"?

Oh, nothing, feel free to provide examples for other built-in types.

> How many other built-in types does Emacs Lisp have?

(length cl--generic-typeof-types) suggests 35.

> Can you list them all by heart? Can everyone?

Just because you can't name them doesn't mean you're likely to
accidentally use one of them by accident.

> What about many different packages which may redefine each other's
> types?

Thank you for this example: this problem has been with us since Emacs-19
got defstruct.  So what you all been doing all these years not trying to
solve this problem?

> Especially since Emacs Lisp does not have the Common Lisp-style
> package system, and it does not enforce the prefix conventions.

It's not enforced, but it's followed reasonably well these days.

> It seems to me that warning on redefining a type (or defining a type
> with a name which already names a type) is a very good idea.

As I said, I'm not opposed to it.  But I don't think the problem
deserves such a large blurb in NEWS about some very serious new problem
introduced by `make-record`.

> Emacs Lisp already warns on redefining functions with a different
> signature.

There's warning and there's warning.  Elisp doesn't warn when you
redefine with fset/defalias.  It only warns when you *compile* the code
that does.

> Why not warn about types?

As long as it's done at compile-time or equivalent (e.g. not in
`make-record`), I don't object (but given how rarely defclass/defstruct
is used I don't see a strong need for it either).


        Stefan




reply via email to

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