From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#40693: 28.0.50; json-encode-alist changes alist Date: Fri, 22 May 2020 21:14:20 +0100 Message-ID: <87eerbybfn.fsf@gmail.com> 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> 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="73372"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux) Cc: darthandrus@gmail.com, 40693-done@debbugs.gnu.org, Dmitry Gutov To: "Basil L. Contovounesios" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 22 22:15:15 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 1jcE4Y-000Iwv-RZ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 22 May 2020 22:15:14 +0200 Original-Received: from localhost ([::1]:34454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jcE4X-0002zK-TI for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 22 May 2020 16:15:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcE4M-0002rD-Pg for bug-gnu-emacs@gnu.org; Fri, 22 May 2020 16:15:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48946) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jcE4M-0001ZI-Gl for bug-gnu-emacs@gnu.org; Fri, 22 May 2020 16:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jcE4M-0005yN-CX for bug-gnu-emacs@gnu.org; Fri, 22 May 2020 16:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 22 May 2020 20:15: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-done@debbugs.gnu.org id=D40693.159017847522901 (code D ref 40693); Fri, 22 May 2020 20:15:02 +0000 Original-Received: (at 40693-done) by debbugs.gnu.org; 22 May 2020 20:14:35 +0000 Original-Received: from localhost ([127.0.0.1]:60491 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcE3p-0005xE-6c for submit@debbugs.gnu.org; Fri, 22 May 2020 16:14:34 -0400 Original-Received: from mail-wr1-f43.google.com ([209.85.221.43]:33590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcE3o-0005wz-9T for 40693-done@debbugs.gnu.org; Fri, 22 May 2020 16:14:28 -0400 Original-Received: by mail-wr1-f43.google.com with SMTP id l11so11397082wru.0 for <40693-done@debbugs.gnu.org>; Fri, 22 May 2020 13:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=yrOqxgMAHHhKHj0nrl4zPWDovl1cG/AtAgDTmEQNjZA=; b=WxsUdIn1JOQ7HCve6BKYpSa7sLjauHUwulV1NOQ14pHaOrw1Kqkx15OqxwqTr6k4ff W/NFMrJGzOzOFFduG59VBcrXYSlvEoou07BPZQiQRuNX/0rAD0RHowZGSr1nXOtvUqPh P6kyJ+5OO0tYDau+67end1qq2u1qoO+r1EloNTQbL3W/cZmRbol5h0Lex0xAUxP7DB/b Y4rdtARgV2B6DRBU8zo81iTKV8g8WYeTvhKIulV3Jx+CdoX+vCPUvNWwuv99I7f0gPfV 1Bm0CpZdfhF+jSZ0inPFqbPx4dami33HB8xEXV8UPzOpFuxaGVzCrCIL9e7foydcetu+ BqTA== 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=yrOqxgMAHHhKHj0nrl4zPWDovl1cG/AtAgDTmEQNjZA=; b=oaxOlvM6wvgIZvC8jNCq/4m+yPz+4YEqGykRcfnB/Uy3PztAe6uvyK+GRYUfHCAkpP cp1saAvrvP26yFxhRVTEgxieSlueHOcTsDwPYssDgUBBxIF+7pjks4XE8AlpDLUJ1OgO +9rPULuxp5a5KSWGPbckOv6so4Ynxzz0KYlAK2OOQhnFUmJiiIcU3bla6HxYoVQhQY0k nM/ynASH/MozoH5K7ncrOFNu0NAF/OkFp9LmYhSRg6Pi5cjLCTiiSjujvglJUcJzEbGH HozlO12VKT4QeF0KCDWnWmfS4HgNqi9hMsbzkZEhGe/4jeqFcP2eE4tZ/k8L9Uv/xgrd SkBA== X-Gm-Message-State: AOAM531nodBo8bV9fInoaAJ3nH4HjjWHI7vmZejgALUQB5/9P3a0t7YL 6BL5hElsL+Nrdfw6rayJ8tzDxHYKHHM= X-Google-Smtp-Source: ABdhPJygnUEi6oH978QA18YrOft0odpH12fAvt91Q5tJ9sfmlQl5/zJO8KrzF+4vLgLmYtHpJ0HW3A== X-Received: by 2002:a5d:4dd0:: with SMTP id f16mr3057726wru.117.1590178462043; Fri, 22 May 2020 13:14:22 -0700 (PDT) Original-Received: from krug ([2001:818:d820:9500:824a:171:15a:2213]) by smtp.gmail.com with ESMTPSA id i74sm10343763wri.49.2020.05.22.13.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 13:14:21 -0700 (PDT) In-Reply-To: <87sgfs81g6.fsf@tcd.ie> (Basil L. Contovounesios's message of "Fri, 22 May 2020 15:54:33 +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:180782 Archived-At: "Basil L. Contovounesios" writes: >> Am I missing something or doesn't this work like you want? > > There's a problem with the conditional require at byte-compile time. If > the version of Emacs doing the byte-compilation has native JSON support, > then it will generate invalid byte-code (and complain) for the case > where there is no native JSON support. In other words, there will be a > bug when an Emacs without native JSON loads a file that was > byte-compiled in an Emacs with native JSON. This doesn't give any any warning: (defvar foo-42 42) =20=20=20=20=20 (provide 'foo) ;; foo.el ends here and a bar.el (eval-and-compile (defvar bar-have-native-42 t) ;; or nil =20=20=20=20=20 (unless bar-have-native-42=20 (require 'foo))) =20=20=20=20=20 (defalias 'forty-two (if (eval-when-compile bar-have-native-42) (lambda () (message "%s" 42.0)) (lambda () (message "%s" foo-42)))) ;; bar.el ends here And it seems to work in both cases: ~/tmp =E2=9D=AF=E2=9D=AF=E2=9D=AF emacs -Q --batch -L . -f batch-byte-= compile bar.el ~/tmp =E2=9D=AF=E2=9D=AF=E2=9D=AF emacs -Q --batch -L . -l bar.elc -f = forty-two 42.0 # now change that t to nil ~/tmp =E2=9D=AF=E2=9D=AF=E2=9D=AF emacs -Q --batch -L . -f batch-byte-= compile bar.el ~/tmp =E2=9D=AF=E2=9D=AF=E2=9D=AF emacs -Q --batch -L . -l bar.elc -f = forty-two 42 But indeed in the recipe I gave you, I had forgotten the second eval-when-compile. If you take that away, it warns again. No idea how to check if byte-code is "valid" or not: I just check the warnings. Can you tell me? > Thanks. I've therefore gone with the original patch[1], as it exhibits > correct behaviour and is the least intrusive, but you should obviously > feel free to tweak it as you prefer. I think I'll let it be, the reason I'm not a huge fan is the foward declarations of individual functions and variables, but it's not so bad. Jo=C3=A3o