From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] * etc/NEWS: Document incompatibilities introduced by record types. Date: Wed, 13 Dec 2017 11:30:38 -0500 Message-ID: References: <20171211213729.41411-1-phst@google.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1513182693 10463 195.159.176.226 (13 Dec 2017 16:31:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 13 Dec 2017 16:31:33 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 13 17:31:29 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eP9wO-0002Wq-DV for ged-emacs-devel@m.gmane.org; Wed, 13 Dec 2017 17:31:28 +0100 Original-Received: from localhost ([::1]:36228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eP9wV-0006ok-Eu for ged-emacs-devel@m.gmane.org; Wed, 13 Dec 2017 11:31:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eP9vo-0006oY-CQ for emacs-devel@gnu.org; Wed, 13 Dec 2017 11:30:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eP9vk-00051Q-8O for emacs-devel@gnu.org; Wed, 13 Dec 2017 11:30:52 -0500 Original-Received: from [195.159.176.226] (port=49272 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eP9vk-00050U-00 for emacs-devel@gnu.org; Wed, 13 Dec 2017 11:30:48 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1eP9va-0000Ke-Hs for emacs-devel@gnu.org; Wed, 13 Dec 2017 17:30:38 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 54 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:LLfUwro66kOW4zoa3nlCYddyB7k= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221008 Archived-At: >>> 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