From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: evaluating numbers Date: Sat, 09 Nov 2019 23:47:34 -0500 Message-ID: References: <875zjw2emg.fsf@gmx.net> <618B38D9-CD34-4200-8CA1-1A6B0922A83A@traduction-libre.org> <871ruk2d3f.fsf@gmx.net> <3C929D7B-1C10-4713-9EDA-55C80FC36AD8@traduction-libre.org> <835zjvg385.fsf@gnu.org> <83sgmyd6rw.fsf@gnu.org> <835zjucwbz.fsf@gnu.org> <628A3663-BDD3-47C5-B4F4-E260FD900691@traduction-libre.org> <83o8xla50f.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="232511"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Emacs development discussions To: Jean-Christophe Helary Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 10 05:48:12 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iTf91-000yL4-Mm for ged-emacs-devel@m.gmane.org; Sun, 10 Nov 2019 05:48:12 +0100 Original-Received: from localhost ([::1]:41238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTf8z-0006wK-MA for ged-emacs-devel@m.gmane.org; Sat, 09 Nov 2019 23:48:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59883) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTf8V-0006v6-C3 for emacs-devel@gnu.org; Sat, 09 Nov 2019 23:47:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iTf8T-0007lb-QH for emacs-devel@gnu.org; Sat, 09 Nov 2019 23:47:38 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:24021) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iTf8T-0007lX-Lg for emacs-devel@gnu.org; Sat, 09 Nov 2019 23:47:37 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 138711009ED; Sat, 9 Nov 2019 23:47:37 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A54FE1002E2; Sat, 9 Nov 2019 23:47:35 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1573361255; bh=qMD6C6MwGVs6WPsH20SFhDBRNzA7dPFgEjuPmnnUcTc=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=i9f0ONMi7u95CzjlEJAIzptr9R2kDHyrDfNqfZdWsLWfBmOR1BZdCDZ+vqM+iOLcH dwjbXtvWVaIDYqkKWOnRUjGf3aeLWJhK3av5ecnDHmyh/SJJT11d8bAkz+xG1nfxmx Qg49rVq9icl8+BL4kkolzKE7cFuXismy450XGwCrt29rb6MVcpHcWa/cIsGZhCPk8M Q2PX/wpWZ2IFSLm6cZ+CpuhvQVkEo3mCRHvmysJ1E2wcuOvGR5JnsydVGPtxthu1Rn iGnXIGV5Kw1WY3pBFegwyjJYohA8xlLl8yKo9Yt6LLI1+wishKFXZ81FLSirhRTuJU cbcFuBsSX6liA== Original-Received: from pastel (unknown [216.154.27.52]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 659FD12061D; Sat, 9 Nov 2019 23:47:35 -0500 (EST) In-Reply-To: (Jean-Christophe Helary's message of "Sun, 10 Nov 2019 09:22:19 +0900") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 132.204.25.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:242066 Archived-At: >>>> Characters are just integers in Emacs. >>> I know that. You're not really answering the above question. When people >>> expect a character to be returned, they expect a character and not >>> a code point. >> Emacs can't know what the user expects. > Developers can know. >>> How useful is: >>> (decode-char 'emacs 345) >>> 345 (#o531, #x159) >> And the code that displays "345 (#o531, #x159)" doesn't know that this >> 345 is coming out of a function which is expected to return characters. > Considering the documentation of decode-char ("returns a character"), that's > either an implementation error or a documentation error... So you're suggesting that the eval-expression function should look at the `car` of the expression that it evaluated, then fetch its docstring and see if it claims to return a character? I'd encourage you try and write such a hack. Then consider whether (and how) it should try and handle cases such as (let ((x 345)) (decode-char 'emacs x)) or (1+ (decode-char 'emacs 345)) or (funcall #'decode-char 'emacs 345) or (aref s 3) [ Side note: I'm the guy who wrote the code that displays those ? thingies, and I'm a great fan of them (and I remove the eval-expression-print-maximum-character limit). But I'll also note that if you want to see the char, you can simply wrap your expression inside a `string` call, as in M-: (string (decode-char 'emacs 345)) RET ] I think you're just beginning to discover that XEmacs's decision to have characters as a built-in type, separate from integers, does occasionally offer some benefits ;-) Stefan