From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Fwd: Re: Inadequate documentation of silly characters on screen. Date: Thu, 19 Nov 2009 18:10:54 -0500 Message-ID: References: <20091118191258.GA2676@muc.de> <20091119082040.GA1720@muc.de> <874ooq8xay.fsf@wanchan.jasonrumney.net> <20091119141852.GC1720@muc.de> <20091119155848.GB1314@muc.de> <837htmqp0e.fsf@gnu.org> <20091119215707.GI1314@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1258672284 29772 80.91.229.12 (19 Nov 2009 23:11:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Nov 2009 23:11:24 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org, schwab@linux-m68k.org, jasonr@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 20 00:11:16 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NBG9j-0006cf-TH for ged-emacs-devel@m.gmane.org; Fri, 20 Nov 2009 00:11:16 +0100 Original-Received: from localhost ([127.0.0.1]:34674 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NBG9j-0001TQ-4l for ged-emacs-devel@m.gmane.org; Thu, 19 Nov 2009 18:11:15 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NBG9b-0001SO-6U for emacs-devel@gnu.org; Thu, 19 Nov 2009 18:11:07 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NBG9V-0001O2-3z for emacs-devel@gnu.org; Thu, 19 Nov 2009 18:11:06 -0500 Original-Received: from [199.232.76.173] (port=37760 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NBG9U-0001No-TX for emacs-devel@gnu.org; Thu, 19 Nov 2009 18:11:00 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:57012) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NBG9Q-0008P0-Am; Thu, 19 Nov 2009 18:10:56 -0500 Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id nAJNAsH8022237; Thu, 19 Nov 2009 18:10:54 -0500 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id A2ED73A1B8; Thu, 19 Nov 2009 18:10:54 -0500 (EST) In-Reply-To: <20091119215707.GI1314@muc.de> (Alan Mackenzie's message of "Thu, 19 Nov 2009 21:57:07 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3410=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:117309 Archived-At: > The abstraction is broken. It is broken because it isn't abstract - its > users have to think about the way characters are represented. In an > effective abstraction, a user could just write "=F1" or ?=F1 and rely on = the > underlying mechanisms to work. > Instead of the abstraction "string", we have two grossly inferior > abstractions, "unibyte string" and "multibyte string". No: the abstraction "multibyte string" is what you call "a string", it's absolutely identical. The only problem is that there's one tiny but significant unsupported spot: when you write a string constant you may think it's a multibyte string, but Emacs may disagree. The abstraction "unibyte string" is what you might call "a byte array". It doesn't have much to do with your idea of a string. > Please suggest to me the correct elisp to "replace the zeroth character > of an existing string with Spanish n-twiddle". For a unibyte string, it's impossible since "Spanish n-twiddle" is not a byte. For multibyte strings, `aset' will work dandy (tho inefficiently of course because we're talking about a string, not an array). > If this is impossible to write, or it's grossly larger than the buggy > "(aset nl 0 ?=F1)", that's a demonstration of the breakage. Except the breakage is elsewhere: you expect `nl' to be a multibyte string (i.e. "a string" in your mind), whereas Emacs tricked you earlier and `nl' is really a byte array. > Why is it necessary to distinguish between 'A' and 65? It's not usually. Because in almost all coding systems, the character A is represented by the byte 65. >> No, I don't agree. If you want to get a human-readable text string, >> don't use aset; use string operations instead. > There aren't any. Of course there are: substring+concat. > I don't imagine anybody here would hold that the current state of strings > is ideal. I'm still trying to piece together what the essence of the > problem is. The essense is that "\n" is not what you think of as a string: it's a byte array instead. And Emacs managed to do enough magic to trick you into thinking until now that it's just like a string. Stefan