From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.devel Subject: Re: Has eval-and-compile changed in emacs 27? Date: Thu, 25 Feb 2021 15:30:17 +0000 Message-ID: <87k0qwxj06.fsf@tcd.ie> References: <83sg5kry4x.fsf@gnu.org> <8735xk5gqi.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25352"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Eli Zaretskii , Leo Liu , emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 25 16:32:16 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lFIci-0006Uk-8c for ged-emacs-devel@m.gmane-mx.org; Thu, 25 Feb 2021 16:32:16 +0100 Original-Received: from localhost ([::1]:59770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFIch-00018B-An for ged-emacs-devel@m.gmane-mx.org; Thu, 25 Feb 2021 10:32:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFIax-0000I9-Ba for emacs-devel@gnu.org; Thu, 25 Feb 2021 10:30:27 -0500 Original-Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:32957) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lFIau-0005wE-1k for emacs-devel@gnu.org; Thu, 25 Feb 2021 10:30:27 -0500 Original-Received: by mail-wm1-x330.google.com with SMTP id i7so5133030wmb.0 for ; Thu, 25 Feb 2021 07:30:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=GQpRSM9GQETOzVrbEMJwj9UZ97UkcIU2YNYnukAs5qA=; b=KEkoLA6eylXxkZmvQjCDZWBWJvj4nZzCQUIkHnBhHwXc61GOoDBdKO/yQW1+vZlWO5 GSPjovqqZKKscPyIHNL3mzMoFf+/0d8qCKBVby9izE/HUP5Vt82DCP6+BqG6lT8ZZ29J Qic1oUXv3eGH0znBHX8x9Wxl9ZI34URGsuW5ZaufVNk8Nz785mss0yv0fX3zhgHAXkYn NBj+JiRGios+UG+3w4tUTml9dHddj7Q20o9BVt1T4ix6LfvW/w4f2MHijEBPoTdj5GzI ktzL9RBclVKNzaB6D0HGR/Oui3xmZLSzA2QqAHcLZsIRX90j78b+nY74sKw8VlDZOqZ8 yKsg== 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; bh=GQpRSM9GQETOzVrbEMJwj9UZ97UkcIU2YNYnukAs5qA=; b=NJAKilg+joVVPKJDE7xSQEzHfVOpVGSSqItpRCtxk3nWIfDS0quC7OXHQLnIJHo/ZP doDqGguVJ+QscS0qd1zeTJfcJF/tnQfRDV8236M99OBugUmdaEml/VLTJXO88Q4wEeBe 0EgMOA1ahTMnFVPEzdoU2+5QMtWOMzrvf/D8whpEWiesCXRyXiIG6D2RiYls5/CBkBOy zbLAgaGQzOBBiGuVLnjb1c8jEW2T+0fNIkfhfuh/CYFEdGMklm49fCFdC5Pgyph7m2XS zYiiCjSvx4H0g8gXXGiRh9TdkBV/eMuE+JE1FNZY3j4cbruph9s1g7DzgFMz04t3onMg aRuw== X-Gm-Message-State: AOAM533LJcedrjtOtbQa9uJwpRMpVm/SYGElGsQtpunpPYGY9PNUShqo dKSgfaeMVq6mjotyInP6xKmjFQ== X-Google-Smtp-Source: ABdhPJzhBja3IqRqQWJMZtBYpjo2g8IGVFmtoGkDfZW70MjRg10E04Ncuiyp+Vnd5P9cP5EZ3RmH0w== X-Received: by 2002:a7b:cd04:: with SMTP id f4mr3765202wmj.76.1614267018780; Thu, 25 Feb 2021 07:30:18 -0800 (PST) Original-Received: from localhost ([2a02:8084:20e2:c380:f410:82e8:3a21:eedf]) by smtp.gmail.com with ESMTPSA id y18sm8585549wrq.61.2021.02.25.07.30.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Feb 2021 07:30:18 -0800 (PST) In-Reply-To: <8735xk5gqi.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 25 Feb 2021 16:06:45 +0100") Received-SPF: none client-ip=2a00:1450:4864:20::330; envelope-from=contovob@tcd.ie; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:265624 Archived-At: Lars Ingebrigtsen writes: > Eli Zaretskii writes: > >> eval-and-compile doesn't make sure the function is known at run time, >> it only makes sure it is known at compile time. > > That's `eval-when-compile', surely... `eval-and-compile' also evaluates > at load time. Yes, but non-top-level requires don't usually make functions known at run time; for that one needs autoload/declare-function. Here's how I'd write this particular code, for example: (autoload 'json-encode "json") (defun ... (if (not json) (pp table (current-buffer)) (defvar json-encoding-pretty-print) (let ((json-encoding-pretty-print t)) (insert (json-encode table)))) ...) or alternatively: (defun ... (if (not json) (pp table (current-buffer)) (require 'json) (defvar json-encoding-pretty-print) (declare-function json-encode "json" (object)) (let ((json-encoding-pretty-print t)) (insert (json-encode table)))) ... -- Basil