From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: (aset UNIBYTE-STRING MULTIBYTE-CHAR) Date: Fri, 15 Feb 2008 10:39:01 +0900 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1203039593 26888 80.91.229.12 (15 Feb 2008 01:39:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 Feb 2008 01:39:53 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 15 02:40:17 2008 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 1JPpYg-00031S-Sx for ged-emacs-devel@m.gmane.org; Fri, 15 Feb 2008 02:40:11 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JPpYC-0003Rd-Q0 for ged-emacs-devel@m.gmane.org; Thu, 14 Feb 2008 20:39:40 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JPpY9-0003RT-9G for emacs-devel@gnu.org; Thu, 14 Feb 2008 20:39:37 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JPpY7-0003QG-4M for emacs-devel@gnu.org; Thu, 14 Feb 2008 20:39:36 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JPpY6-0003QB-Ua for emacs-devel@gnu.org; Thu, 14 Feb 2008 20:39:34 -0500 Original-Received: from mx1.aist.go.jp ([150.29.246.133]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JPpY1-0006tE-RE for emacs-devel@gnu.org; Thu, 14 Feb 2008 20:39:34 -0500 Original-Received: from rqsmtp2.aist.go.jp (rqsmtp2.aist.go.jp [150.29.254.123]) by mx1.aist.go.jp with ESMTP id m1F1d8FC000670; Fri, 15 Feb 2008 10:39:11 +0900 (JST) env-from (handa@m17n.org) Original-Received: from smtp4.aist.go.jp by rqsmtp2.aist.go.jp with ESMTP id m1F1d79S001003; Fri, 15 Feb 2008 10:39:07 +0900 (JST) env-from (handa@m17n.org) Original-Received: by smtp4.aist.go.jp with ESMTP id m1F1d1GE016055; Fri, 15 Feb 2008 10:39:01 +0900 (JST) env-from (handa@m17n.org) Original-Received: from handa by etlken.m17n.org with local (Exim 4.69) (envelope-from ) id 1JPpXZ-0006Ii-JY; Fri, 15 Feb 2008 10:39:01 +0900 In-reply-to: (message from Stefan Monnier on Wed, 13 Feb 2008 10:33:23 -0500) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/23.0.60 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) X-detected-kernel: by monty-python.gnu.org: Solaris 8 (1) 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:89129 Archived-At: In article , Stefan Monnier writes: > > Something like this code: > > (setq result (cons > > (let ((str (make-string 1 0))) > > (aset str 0 (make-char 'japanese-jisx0208 ku ten)) > That's truly horrendous code. I see no reason to support it. > > although it's easy to fix it... > Not only it's easy but the result is more efficient/legible/maintainable. Even if the code is very bad, it worked in Emacs 22. If it doesn't work in Emacs 23, it's a regression. >>> aset on strings is fundamentally problematic, so anything that restricts >>> it further is good in my book (my own local Emacs disallows them >>> plainly, and I rarely bump into code that needs it). > > What is the fundamental problem? > The one you're bumping into: multibyte strings are not arrays and > treating them like ones asks for trouble: the performance is not the one > expected, the implementation is complex and ugly, ... The problem here is that (make-string 1 ?a) is a unibyte string, but "a" generated by buffer-substring on a multibyte buffer is a multibyte string. The result of concatinating them is also multibyte. So, the multibyteness of strings is difficult of expect. If we are going to inhibit aset on multibyte strings, I think we should inhibit aset on any strings to avoid a further confusion. > When weighed against the *very* rare cases where aset is used (let > alone the even more rare cases where aset is actually useful and > convenient), the choice is trivial (for me anyway). Then, shouldn't we start the experiment of inhibitting aset on strings just now? --- Kenichi Handa handa@ni.aist.go.jp