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: Using the GNU GMP Library for Bignums in Emacs Date: Tue, 10 Jul 2018 23:16:05 -0400 Message-ID: References: <29f933ac-a6bf-8742-66a7-0a9d6d3e5a88@disroot.org> <83bmecy6fx.fsf@gnu.org> <0d3175d8-d996-651e-b221-71978bde3a65@cs.ucla.edu> <87tvpdnzgy.fsf@tromey.com> <4c2a814f-c254-29e5-39cf-11b5f2e5c9c8@cs.ucla.edu> <49d8ba62-c9a5-9203-d882-8e900b441ff3@cs.ucla.edu> <8e0320d9-e0d0-2b57-57cc-2df4399f133c@cs.ucla.edu> <87lgaio7xd.fsf@tromey.com> <9ee4b3c6-9d87-a8e6-7e07-455da91c8966@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1531278893 18764 195.159.176.226 (11 Jul 2018 03:14:53 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 11 Jul 2018 03:14:53 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Tom Tromey , emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 11 05:14:48 2018 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 1fd5aa-0004nS-MF for ged-emacs-devel@m.gmane.org; Wed, 11 Jul 2018 05:14:48 +0200 Original-Received: from localhost ([::1]:51447 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fd5ch-0006o2-P9 for ged-emacs-devel@m.gmane.org; Tue, 10 Jul 2018 23:16:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fd5by-0006lo-74 for emacs-devel@gnu.org; Tue, 10 Jul 2018 23:16:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fd5bv-0001k9-1k for emacs-devel@gnu.org; Tue, 10 Jul 2018 23:16:14 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:39226) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fd5bu-0001k2-RU for emacs-devel@gnu.org; Tue, 10 Jul 2018 23:16:10 -0400 Original-Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id w6B3G5hY018596; Tue, 10 Jul 2018 23:16:05 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 4BEEA661B8; Tue, 10 Jul 2018 23:16:05 -0400 (EDT) In-Reply-To: <9ee4b3c6-9d87-a8e6-7e07-455da91c8966@cs.ucla.edu> (Paul Eggert's message of "Tue, 10 Jul 2018 19:35:15 -0700") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6326=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6326> : inlines <6746> : streams <1792197> : uri <2671777> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 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:227237 Archived-At: >> it's simpler to explain that there are just integers. > Yes, and this is a significant win. I'm not sure I understand why a return value of `bignum` for `type-of` would complicate the doc. AFAICT all it takes is: diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index b94de80b65..3ca5f6399f 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -2034,7 +2034,7 @@ Type Predicates @defun type-of object This function returns a symbol naming the primitive type of -@var{object}. The value is one of the symbols @code{bool-vector}, +@var{object}. The value is one of the symbols @code{bignum}, @code{bool-vector}, @code{buffer}, @code{char-table}, @code{compiled-function}, @code{condition-variable}, @code{cons}, @code{finalizer}, @code{float}, @code{font-entity}, @code{font-object}, There's no need to explain the difference between `integer` and `bignum` here, just like we don't explain the difference between `subr` and `compiled-function`. > If interning bignums (so that eq works on them) is what it takes to satify > Stefan's concerns, then I'm all for interning them. The idea is to avoid > unnecessary distinctions between fixnums and bignums, so that Lisp > programmers can focus on their problems rather than worry about integer > representation. Although it's OK to have user-visible predicates fixnump and > bignump for the few programmers who really need to know, I'm not seeing use > cases for why these predicates should be any more special than characterp or > natnump are. [...] > That's fine, but I was asking for use cases not implementation > motivation. THat is, I was wondering why a Lisp programmer would want to use > cl-generic that way. Having cl-generic distinguish fixnums from bignums > sounds like more a solution looking for a problem than a truly > useful feature. I think I'm missing a reality check here. We are talking about `type-of`, right? Have you looked at how many times it's used in Elisp? It's a rather obscure function (and indeed the lispref recommends to use predicates instead: type-of might be handy to implement other things (like cl-generic) but is otherwise rather inconvenient to use). So, yes, the motivation is thin because the decision will be irrelevant in 99.99% of the cases. If you're really dead-set on having it hide the difference between fixnums and bignums, I won't oppose it. I just mentioned my preference based on the fact that cl-generic is (AFAIK) by far the most common user of `type-of` nowadays. Stefan