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#70007: [PATCH] native JSON encoder Date: Sat, 24 Aug 2024 19:14:22 +0300 Message-ID: <86ikvpnbj5.fsf@gnu.org> References: <1BF559D1-DB9F-4FEB-90ED-72E0EFD76424@gmail.com> <86wmpphrg7.fsf@gnu.org> <4589243D-C11A-45C1-AF3E-6F4A5BADEB54@gmail.com> <864jcrindg.fsf@gnu.org> <291DD5F1-85B8-4647-A40A-EBBD4C51E253@gmail.com> <8634sbijfx.fsf@gnu.org> <2CF47DA5-A65B-47C4-A28A-6FEE1469BD13@gmail.com> <86cyrdfuai.fsf@gnu.org> <3139C8FE-5C67-4FE3-B940-F449DA73E76C@gmail.com> <86le5zdfbi.fsf@gnu.org> <4C93E902-282D-4408-B449-C8E771B2B3E4@gmail.com> <86cyr7agjo.fsf@gnu.org> <850DEC32-F318-4F3E-BA87-55FC6DC74CD3@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32891"; mail-complaints-to="usenet@ciao.gmane.io" Cc: casouri@gmail.com, 70007@debbugs.gnu.org To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 24 18:15:37 2024 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 1shtQO-0008Ox-OS for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Aug 2024 18:15:36 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shtQC-0008I3-EJ; Sat, 24 Aug 2024 12:15:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1shtQ2-00081x-TJ for bug-gnu-emacs@gnu.org; Sat, 24 Aug 2024 12:15:15 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shtQ1-0006ox-Hw for bug-gnu-emacs@gnu.org; Sat, 24 Aug 2024 12:15:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-version:References:In-Reply-To:From:Date:To:Subject; bh=kFlubvQjK7eyfmcu++q27xKjsE1cHHTRdnclv++HgTQ=; b=GuR4u0pqlYmDcVGKQX2+SrkYztV3kRp1Ki4PgDcPPqPq6VaoZoyUyDyiMHzE+oXBu/LW8eMGW7IkAX2sowbHHsy9EUJ4xhG4isNtHD7I4UD2VkF6iYe4DaQsS020U87oWhpDynpavrNwqt/Myr+O3XA4Gt0N4ByvFgtO6rKanP/M5wQY0b1RhEb6Iy6hiyviZVi6+oj6o/SsT/q31wZ6M70h30PKpemJtzm+x5R2HcVgjCnWzShU1Yj2wOjCiuaghioWbpE6+v8kAEz1auln7aFDGZQ+2gBppXZOlcQG8EiKQmdwOOmwKaK9eD019TFultBy1AEQIHp36JoCUPudyg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1shtQn-0003ob-Tu for bug-gnu-emacs@gnu.org; Sat, 24 Aug 2024 12:16:01 -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, 24 Aug 2024 16:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70007 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70007-submit@debbugs.gnu.org id=B70007.172451612314600 (code B ref 70007); Sat, 24 Aug 2024 16:16:01 +0000 Original-Received: (at 70007) by debbugs.gnu.org; 24 Aug 2024 16:15:23 +0000 Original-Received: from localhost ([127.0.0.1]:41812 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shtQA-0003nQ-Vq for submit@debbugs.gnu.org; Sat, 24 Aug 2024 12:15:23 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43046) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shtQ8-0003nB-0T for 70007@debbugs.gnu.org; Sat, 24 Aug 2024 12:15:21 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1shtPF-0006bi-FG; Sat, 24 Aug 2024 12:14:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=kFlubvQjK7eyfmcu++q27xKjsE1cHHTRdnclv++HgTQ=; b=MUjUtZjM3mg95MWDZ/GT mH4Gh2qRE1bYaG/Px6ZIrMdNzWF50bo/4FIxn+ck9EtecEO8OHAN6gXBPl8evI7Rz+ji1pPI23ZVe /tAn2vOTIcxSDXvGK/LKEuqQw1yE50RZtwQb1LTz+pgwE7DYpgWXPMF9x9pYlbtJB8Or8l1C/ZenE GZCSa4PEVRAj4RSc98PLEyOPkHWz+0jBshK0493UsK52QekVZviab/pHGoMvbJVtnb5QIkySAmyII FtJl6N9g+HtLAZktJTNeFltwA8mSJVKSVl5D/1mFKLnM9y75cCGaF4VnNEKghovfl2zDHlmvFrGQ4 arsKzVebZnjX5Q==; In-Reply-To: (message from Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= on Sat, 24 Aug 2024 17:33:33 +0200) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:290682 Archived-At: > From: Mattias EngdegÄrd > Date: Sat, 24 Aug 2024 17:33:33 +0200 > Cc: Yuan Fu , > 70007@debbugs.gnu.org > > (I'm going through some old unfinished work.) > > The only major issue remaining here would be whether `json-serialize` should return a multibyte string, as it does now, or a unibyte string. I think we agree that unibyte is the correct choice in general, and since the code is new in Emacs 30 we should make a decision now because changing it in Emacs 31 will be riskier. On the other hand, the old libjansson implementation returned a multibyte string. > > I've looked at packages using the API and they appear entirely agnostic -- the result is almost always a string that is fed into `process-send-string`. We are very late in the release process to make such changes without reservations. We should have discussed this much earlier, but that's water under the bridge. Since this could potentially (albeit unlikely) break someone's code, I'm okay with making this change, but with a twist: let's have a variable which could be let-bound around the call to json-serialize, to make the result a multibyte string instead of the default unibyte. This is so if someone comes back crying that we broke his/her code, they could have an easy fire escape. OK? P.S. Of course, the fact that the result is a unibyte string should be mentioned in the doc string.