From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.bugs Subject: bug#40693: 28.0.50; json-encode-alist changes alist Date: Sat, 23 May 2020 23:41:20 +0100 Message-ID: <87eerab7fz.fsf@tcd.ie> References: <87a738jotd.fsf@tcd.ie> <87mu6utxd1.fsf@tcd.ie> <83r1w6ziql.fsf@gnu.org> <82572c3f-fb24-0b01-06ec-47067d9219ca@yandex.ru> <83blnazdly.fsf@gnu.org> <87wo5yqrqo.fsf@tcd.ie> <87ftbyavbq.fsf@tcd.ie> <87zha43ira.fsf@gmail.com> <87367t9ej7.fsf@tcd.ie> <87imgp2atd.fsf@gmail.com> <87sgfs81g6.fsf@tcd.ie> <87eerbybfn.fsf@gmail.com> <87wo52ochm.fsf@tcd.ie> <87a71ywicb.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="33421"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: darthandrus@gmail.com, 40693@debbugs.gnu.org, Dmitry Gutov To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 24 00:42:12 2020 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 1jccqH-0008Yn-GT for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 May 2020 00:42:09 +0200 Original-Received: from localhost ([::1]:60328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jccqG-0005if-I3 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 May 2020 18:42:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jccqA-0005iW-NC for bug-gnu-emacs@gnu.org; Sat, 23 May 2020 18:42:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52645) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jccqA-00026t-DI for bug-gnu-emacs@gnu.org; Sat, 23 May 2020 18:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jccqA-0007lT-Ab for bug-gnu-emacs@gnu.org; Sat, 23 May 2020 18:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 May 2020 22:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40693 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed patch Original-Received: via spool by 40693-submit@debbugs.gnu.org id=B40693.159027369029806 (code B ref 40693); Sat, 23 May 2020 22:42:02 +0000 Original-Received: (at 40693) by debbugs.gnu.org; 23 May 2020 22:41:30 +0000 Original-Received: from localhost ([127.0.0.1]:35958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jccpe-0007kg-Bh for submit@debbugs.gnu.org; Sat, 23 May 2020 18:41:30 -0400 Original-Received: from mail-wr1-f45.google.com ([209.85.221.45]:33977) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jccpc-0007kU-Gp for 40693@debbugs.gnu.org; Sat, 23 May 2020 18:41:28 -0400 Original-Received: by mail-wr1-f45.google.com with SMTP id g12so12585075wrw.1 for <40693@debbugs.gnu.org>; Sat, 23 May 2020 15:41:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=oFChX1p5fPpBbEP0+X2e6X9sGp1TPv69dIm0w4ZGNtM=; b=Q1VXGLW06OVUQEu+RjX/2RJCrj+j5JJY4fzHYqdOMISEeh+mTn1U/IK0xE9mlf3IH1 RK3CYP5CjqJxJ/+Ggy6c0BniKl8YoNNjOr75J0sbBpH/S+LaWCpzvorUcd+SR1sb7Fld 6g+xpEelb8nmxPgNm6AgVI2sdLttTt8waZn8eIRPzeA2F6z30jVzoU0m7nNL3TVausGa PaBlzM4rHYoibcLYnLW3AtNkdi4P5cU/v8kC8OGtw5dynTxlO1zbq7rv3Na1XgNgkFUQ jvO005iKS8JlUm4NxIkwhybj6LGkDFDwqkPZEssn6wybZR9pygFIdQSbFUe/0rY/7kFK +3XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=oFChX1p5fPpBbEP0+X2e6X9sGp1TPv69dIm0w4ZGNtM=; b=d8f1hfpfmsdD95dDpOkCvaHkUMqBfnaNspfxdXvX3DG7E68th702nLDp9+zfLejXsT 4AdG0mfnamz1+RwDTEblxNOO+p7IBBl63Uo2asZ1qY3zrYRDNapp5URXy4uF3ogahUqp XnT8lPQr56SM+qlqyzwYoHfs5NSwSgbB3ycOn+/i0c3i+A9hgaFL6kkMQDd5AQK5Ku2X ZqFGuotm66T0+OcFfnqJZ/+q5ZEgXbUmwFl1cD+Exr7YmuaOFoY/1HemP2ZwQ7O1JkD1 tvFEw7qdSQFVkjaJmkE/njsSvWmAopsVhj0UAH5efh4VyQQA7ICrP+uArmIkL5dpeq7h CasQ== X-Gm-Message-State: AOAM533pZ3kdCmodHO2gEegoeJhP74lws6KtbnDzEXcHLzjDD5kpAtV6 2voIhxDPlDnOilfWbuRvsBBDLw== X-Google-Smtp-Source: ABdhPJzyRVWqfLSWzn10j4n9NQwAhYpHIXvrAEUhpB+34SCPZnvspwyzM5pMJzmJGb7dsWoHXlCSsQ== X-Received: by 2002:a05:6000:10cf:: with SMTP id b15mr8530249wrx.214.1590273682547; Sat, 23 May 2020 15:41:22 -0700 (PDT) Original-Received: from localhost ([2a02:8084:20e2:c380:1f68:7ff5:120d:64e]) by smtp.gmail.com with ESMTPSA id z12sm2733576wrg.9.2020.05.23.15.41.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 15:41:21 -0700 (PDT) In-Reply-To: <87a71ywicb.fsf@gmail.com> ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Sat, 23 May 2020 20:40:20 +0100") 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:180856 Archived-At: Jo=C3=A3o T=C3=A1vora writes: > "Basil L. Contovounesios" writes: > >> Jo=C3=A3o T=C3=A1vora writes: >>> "Basil L. Contovounesios" writes: > >> 0. bar.el does not use lexical-binding. >> 1. The second lambda in forty-two does not let-bind foo-42. >> 2. If you byte-compile bar.el with bar-have-native-42 set to t, and then >> load bar.elc in an Emacs that has bar-have-native-42 set to nil, then >> 42.0 gets printed, which is wrong. This is due to the incorrect >> usage of eval-when-compile: we want the check to happen at runtime as >> well. > > I think you mean load-time. Yes. > Anyway, this is true if you want 27.1 elc's to be loadable in 26.x. It is also true if you want version N .elc files to be loadable in version N. The problems I list are not specific to either JSON or inter-Emacs-version compat. > I was labouring under the impression that we don't care about that > (and this is why I thought of the macro approach). Do we? The source > file is compatible between multiple emacs version, but is the > byte-compiled file also compatible? This isn't (primarily) about 26/27 compat, but about supporting --without-json configurations properly. In the examples I've given so far I was exclusively using Emacs master --with-json, hence the (fset 'json-parse-buffer nil). Native JSON functions are not guaranteed to be available in any version of Emacs to date, just like D-Bus or X. The only benefit of the macro approach is zero overhead - no fboundp checks at load time, and no indirection in calling jsonrpc--json-read. But those should be negligible costs, and macros come with their slew of drawbacks that makes them unnecessary in this simple case. >>> No idea how to check if byte-code is "valid" or not: I just check the >>> warnings. Can you tell me? >>=20 >> 0. emacs -Q -batch -f batch-byte-compile foo.el >> 1. emacs -Q >> 2. (fset 'json-parse-buffer nil) C-j >> 3. M-x load-file RET foo.elc RET >> 4. (disassemble 'foo) C-j > > Thanks. > >> I think the declarations make the intention explicit to both the reader >> and the byte-compiler in a simple way, without wrestling the >> eval-*-compile machinery or allowing for subtle bugs like the ones >> above. > > The problem, of course, is that you're repeating yourself, a maintenance > hazard. Not too big in this case. Agreed. --=20 Basil