From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Accept plists when serializing and parsing JSON Date: Wed, 30 May 2018 13:37:28 +0700 Message-ID: References: <87sh6awls5.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1527662144 4825 195.159.176.226 (30 May 2018 06:35:44 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 30 May 2018 06:35:44 +0000 (UTC) Cc: Philipp Stephani , Emacs developers To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 30 08:35:40 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fNuhv-00019F-Rt for ged-emacs-devel@m.gmane.org; Wed, 30 May 2018 08:35:39 +0200 Original-Received: from localhost ([::1]:36483 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNuk2-0008UP-JQ for ged-emacs-devel@m.gmane.org; Wed, 30 May 2018 02:37:50 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNujt-0008U6-9k for emacs-devel@gnu.org; Wed, 30 May 2018 02:37:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fNujs-00084F-E2 for emacs-devel@gnu.org; Wed, 30 May 2018 02:37:41 -0400 Original-Received: from mail-oi0-x241.google.com ([2607:f8b0:4003:c06::241]:40670) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fNujs-000845-9V for emacs-devel@gnu.org; Wed, 30 May 2018 02:37:40 -0400 Original-Received: by mail-oi0-x241.google.com with SMTP id f79-v6so1407831oib.7 for ; Tue, 29 May 2018 23:37:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=yHHtkjeAZB5B0LzrGxZouYVh3kY/AC8+27W/0/ek7V0=; b=VJlHsPoogMHvJ2gjzjd7UUYzb7CKrjSl3S9ocXcn/aiVTWVhjfPd2ey6zpDY5bIk+E imv9OzPUJ2+PZZ+JefiVtxiCmBBSq9Ilu9sJnETcEuAsD3NdU4iwJpdp1vuY5DDDhBs3 XmqXN5ti9P4mO++xuzykIpYuAhn6qu03cKI1upf/fHDokW7hsMoSqyBieKFGubkhMun5 xGhWJYqugV6+9ypEztP5p3P5acuj+F0Gt7maVIx9lGBlrFLHrMMs+JqlV0zngoTLtb0t kJ3/r2SX0Pl4Ok7+TmG8t8cxqN9hZ8q9wnRoA8c4Hs6WqOSnvM4Ay47xyRJ4iX9u9/Xc p9qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=yHHtkjeAZB5B0LzrGxZouYVh3kY/AC8+27W/0/ek7V0=; b=SqCLO48d/AHZs41IKLAa1BywUIy4R+uhZh/SDWSffBW7nK+Hyy1PRLWTdUv+SXX1+c kZHfxK1ECxrlLGCsjSxJfAHoIrPvCH9rFdb5hhI67Ro5BUeXDbqnSb3jIBuLWCBJFPGj pHW4TlZUONQA0LWnddmOShj0CHKUHNAjd+LxcXZCyNlhwDxGJx1PzqMq/xmbU7wzolq2 im0LtIQMWsM/uMBH/uIIDcmbMG4FVA9FtIYFQRDtKMOoewMLoaK1P90ddNmvB0XCwM/v 6vp3R1i2/wbksU+Q1T2xsBhe1wBER5eXkWR04PGziEQAjpMv/a1XM6G+bhtUE4syeP7C uuYQ== X-Gm-Message-State: ALKqPwfKftKZhrAZnfAnbJb8E0KrVNGITQkZBEGKnqjuvWestjXTT3+a IWnVFOMjNHrTmArxCfCDfvARZW0MuiJ/XA35VeY= X-Google-Smtp-Source: ADUXVKLzMpkpIw6aXzAR+PWoz4uL4wwCGfxNvt75apA+uqyM4WTPu3oLdZwShMeS2yEAOr2qh5j4JrsoCj9NenSq/s0= X-Received: by 2002:aca:e505:: with SMTP id c5-v6mr817048oih.191.1527662259631; Tue, 29 May 2018 23:37:39 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::241 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:225815 Archived-At: On Wed, May 30, 2018 at 5:31 AM Jo=C3=A3o T=C3=A1vora wrote: > On Tue, May 29, 2018, 22:21 Philipp Stephani wrote: >> Please don't add global state to json.c. It's a low-level library that shouldn't rely on global state (and global state should generally be avoided in libraries). Not having global state was one of my explicit design goals for json.c > Well, it's not really "global state" in the sense I believe you're talking about, because no part of the library is maintaining any state in global variables -- it's read-only from json.c. I think the objection to global state (or a global setting, as the case may be) can be illustrated with the following scenario. * Consider two independent Elisp packages =E2=80=98foo=E2=80=99 and =E2=80= =98bar=E2=80=99, both of which want to use the JSON library. * =E2=80=98foo=E2=80=99 wants plists while =E2=80=98bar=E2=80=99 wants alis= ts. * =E2=80=98foo=E2=80=99 has a hook. The user adds to that hook a function t= hat invokes =E2=80=98bar=E2=80=99. * Result (after ironing out all bugs related to shared state): Every call to the JSON library has to be wrapped in a (let ((json-serialize-use-plists =E2=80=A6)) =E2=80=A6), which is more cumbersome than just passing an argum= ent to a function.