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: Mon, 11 Dec 2017 22:21:34 -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 1513048916 27169 195.159.176.226 (12 Dec 2017 03:21:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 12 Dec 2017 03:21:56 +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 Tue Dec 12 04:21:52 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 1eOb8g-0006kk-Dg for ged-emacs-devel@m.gmane.org; Tue, 12 Dec 2017 04:21:50 +0100 Original-Received: from localhost ([::1]:56486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eOb8n-0000Si-Iy for ged-emacs-devel@m.gmane.org; Mon, 11 Dec 2017 22:21:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eOb8d-0000SS-57 for emacs-devel@gnu.org; Mon, 11 Dec 2017 22:21:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eOb8Z-0000zT-QQ for emacs-devel@gnu.org; Mon, 11 Dec 2017 22:21:47 -0500 Original-Received: from [195.159.176.226] (port=44890 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eOb8Z-0000yb-Jb for emacs-devel@gnu.org; Mon, 11 Dec 2017 22:21:43 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1eOb8Q-00061w-8D for emacs-devel@gnu.org; Tue, 12 Dec 2017 04:21:34 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 36 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:juBJw/CFg4PLQREy8biafwkJCIE= 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:220916 Archived-At: > +** 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