From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "dmantipov" Newsgroups: gmane.emacs.devel Subject: Re: using empty_string as the only "" string Date: Wed, 25 Apr 2007 09:38:15 +0400 (MSD) Message-ID: <462EE947.000007.15251@camay.yandex.ru> Reply-To: dmantipov@yandex.ru NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1177479523 29145 80.91.229.12 (25 Apr 2007 05:38:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 25 Apr 2007 05:38:43 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 25 07:38:41 2007 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 1HgaD9-0004pE-4n for ged-emacs-devel@m.gmane.org; Wed, 25 Apr 2007 07:38:39 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HgaIj-0004WM-CF for ged-emacs-devel@m.gmane.org; Wed, 25 Apr 2007 01:44:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HgaIf-0004WH-Uz for emacs-devel@gnu.org; Wed, 25 Apr 2007 01:44:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HgaId-0004W5-Hj for emacs-devel@gnu.org; Wed, 25 Apr 2007 01:44:20 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HgaId-0004W2-As for emacs-devel@gnu.org; Wed, 25 Apr 2007 01:44:19 -0400 Original-Received: from camay.yandex.ru ([213.180.200.33]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HgaD2-000702-8y for emacs-devel@gnu.org; Wed, 25 Apr 2007 01:38:32 -0400 Original-Received: from YAMAIL (camay.yandex.ru) by mail.yandex.ru id ; Wed, 25 Apr 2007 09:38:15 +0400 Original-Received: from [213.148.29.37] ([213.148.29.37]) by mail.yandex.ru with HTTP; Wed, 25 Apr 2007 09:38:15 +0400 (MSD) X-Mailer: Yamail [ http://yandex.ru ] X-MsgDayCount: 1 X-BornDate: 1119297600 X-Source-Ip: 213.148.29.37 X-detected-kernel: Linux 2.6 (newer, 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:70063 Archived-At: That was an interesting discussion, thanks to all. All CLs I've installed (clisp, cmucl and franz) gives (eq 0 0) => t and (eq "" "") => nil. But a) we can tweak 'eq' to handle this special case (looks poor, but just to purify the language) and b) Emacs isn't a CL and should not obey CLtL2 completely, isn't it ? Immediately after startup but before any user interaction, my emacs binary creates >260 empty strings, and >60 of them survives the first GC. Saving 960 bytes (on 32-bit system) of Lisp_Strings may be considered marginal. But, for example, after you have gnus loaded, you will have >1000 empty strings created, and >600 of them survives the next GC. I don't agree that approx. 10K is a marginal space optimization even if your desktop has 4G RAM. Immediate (built into Lisp_String) short strings is a nice and interesting idea too, IMHO. I don't expect too much from the canonicalization of another objects, 'frequently-used' float numbers like 1.0 or 0.0 in particular. I believe these objects are very rare (in comparison with empty strings) in the most common situations, so it will be just 0.0001% over no-op. > You can modify the multibyteness of an empty string, and a > unibyte empty string and a multibyte empty string behave a > little bit differently, for instance, when concatinated with > an unibyte 8-bit string. How you can modify the multibyteness of an empty string ? You can't aset multibyte char (as well as anything else) into empty string, and conversion functions like 'string-make-unibyte' or 'string-to-multibyte' always creates new strings instead of touching an argument. Moreover, since "" is a no-op in concatenation operations, it may be silently discarded without looking into internal structure, isn't it ? Dmitry