From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#56347: Optimize/simplify STRING_SET_MULTIBYTE Date: Sat, 02 Jul 2022 21:45:21 +0300 Message-ID: <835ykfbbge.fsf@gnu.org> References: <83pmioca3h.fsf@gnu.org> <83letbbhzx.fsf@gnu.org> <83bku7bc3c.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16592"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56347@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 02 20:46:14 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o7i8E-0004D1-Ge for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Jul 2022 20:46:14 +0200 Original-Received: from localhost ([::1]:60192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o7i8C-0002js-4P for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Jul 2022 14:46:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o7i84-0002iP-Ot for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2022 14:46:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48960) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o7i82-00076Z-97 for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2022 14:46:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o7i82-00012i-6V for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2022 14:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Jul 2022 18:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56347 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 56347-submit@debbugs.gnu.org id=B56347.16567875443984 (code B ref 56347); Sat, 02 Jul 2022 18:46:02 +0000 Original-Received: (at 56347) by debbugs.gnu.org; 2 Jul 2022 18:45:44 +0000 Original-Received: from localhost ([127.0.0.1]:42857 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o7i7j-00012C-VF for submit@debbugs.gnu.org; Sat, 02 Jul 2022 14:45:44 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:45694) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o7i7h-00011z-ST for 56347@debbugs.gnu.org; Sat, 02 Jul 2022 14:45:42 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:52176) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o7i7c-0006bw-JA; Sat, 02 Jul 2022 14:45:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=7C7zUwa7DyPgmkXYDqlhOldc/1xoRUiMNGYzmd+f/7g=; b=cFEbceXUnG5i BZ0iJzEX54LbfEZq1/8tza8zn/ib78F8CbhHuksXkiWKtQdZ4ksYoJQJ3KBZQ8Udg3hyxX52A8v4l BsKjurxOqymZfFZcO4ark/ZMb9h4F8hTRv7Btcbiq8DjCnHyQbIBMGfYyP01gkXoaQ+cLn0NRkzhh wGm0qCRUmui3g2sXTQKULdh8yX2wQHgALD+2SlYvSoH+SHxbSAT9ehW8P69rjF1H3hOZLLvFsvg1E s4WvfyMjSE2D+an/91qx210RePDFuEl4jvqQC+4a5cxmyOQSDe0Y32aXvbuBsqte7o7LxG08vzvvg AoGDOp5eG1xvqZsgjqYUrw==; Original-Received: from [87.69.77.57] (port=3403 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o7i7c-00064N-2l; Sat, 02 Jul 2022 14:45:36 -0400 In-Reply-To: (message from Stefan Monnier on Sat, 02 Jul 2022 14:37:18 -0400) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:235953 Archived-At: > From: Stefan Monnier > Cc: 56347@debbugs.gnu.org > Date: Sat, 02 Jul 2022 14:37:18 -0400 > > >> Yes. In my book, STRING_SET_*IBYTE should basically not exist: a string > >> is created as unibyte or multibyte and never changes after that. > > > > That's require a much larger change, I think. It is not enough just > > to add an assertion in one place, because that'd just cause > > maintenance headaches for no real gain. > > `grep STRING_SET_MULTIBYTE` suggests it's not nearly as hard you think. > > The only other use is in `aset`. That's not what I meant. If you want to disallow changing the representation of strings, STRING_SET_MULTIBYTE is just the tip of the iceberg. > >> And indeed because we only have a single copy of the two possible empty > >> strings, they can't be changed between unibyte<->multibyte > > I can create an empty string without those singletons any time. > > My experience is that it takes a fair bit of work to do so. I don't see how that matters here, sorry.