From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id ELEWNz/F3GSjeQAASxT56A (envelope-from ) for ; Wed, 16 Aug 2023 14:46:56 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 8KbnNT/F3GSpcwAAG6o9tA (envelope-from ) for ; Wed, 16 Aug 2023 14:46:55 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8487A500A8 for ; Wed, 16 Aug 2023 14:46:55 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=iro.umontreal.ca header.s=mail header.b=HRmngqe4; dmarc=pass (policy=quarantine) header.from=iro.umontreal.ca; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1692190015; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=8Hr2RIOCW6OKUFoHl5OZIPc4UxWSYRmgifoxAwgU89w=; b=BmEaWcOVB1xVY1yLB/gl7RV3F2tbXL4Yt7cHBKJdBLBeDUOkUdetXI4v7ZJOqsoU4oxBKr ONgq5UIWhlSh8O9EZ/lHJ8RmnHfw8nxkNQJ4zzP2u4a2hqgjJbI/Gix+D+hHR7mGck8Uco bbitPhoRl2OuohC4WQc8U4AU3SWLv5cjQYW/jx94to0PDd7d5/cOx5UlG99I3qElFTE/KX /amFxHarBGT+S1MSBGIwraun8ZZDRyDIRkDnVc5uU0U0yZPd+siSgRMXy67TIIEag67QC3 ZL+Wxc8RUeJnvv0xWRYrRZ5lzgph1D/N3m8j5ArhI5ZdBS5iLUQaiXKooH6nFA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=iro.umontreal.ca header.s=mail header.b=HRmngqe4; dmarc=pass (policy=quarantine) header.from=iro.umontreal.ca; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1692190015; a=rsa-sha256; cv=none; b=MDIB+mkwYkFPmXxj2zVzd3AJygdHgDf01+JdToJfahsC5/9K5KduFI+W4NbuBMIt0ME9Ba XWwXCIyzayR1mWUA3JnUE4CN+DX/x3bpMuEPHWIXh/4utzIiCRW5IeRyRICkfTSJW+nt/v /IQidBDlTfAeV1+0oASzWxuSBCcUJDSXofTJvl1C3oQhqdu4qzzaaIY+pBS6ApAIQl+2wT STo2so/ZkYfJAgUXeeUoqir0ZPhgXLXvpEZ5A6n8dguhdZ2Hn4rNum1YrGlJAjBQK9LP17 6+5J0AHPW7EU06QR9kJWpBWglYfjQ9QBNiSo33mUu21PcfGLer282W/7WIEYWg== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWFg0-0000JY-Qu; Wed, 16 Aug 2023 08:31:04 -0400 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 1qWFfp-0000EW-E4 for emacs-orgmode@gnu.org; Wed, 16 Aug 2023 08:30:58 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWFfm-000062-HH; Wed, 16 Aug 2023 08:30:52 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 1D1B344282C; Wed, 16 Aug 2023 08:30:47 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1692189045; bh=ePGa8xNAkDtjb7XntarWkRH9qayTAQjVZx7t9gRCI6g=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=HRmngqe4Gg4I5y4X7+ProUdFQXT/7yhvhUOOa7ji8et0QYBh5o188f6BsyvBVTUKf o07P417FDgkksJgb2BCWgqe59ygrTJ4gWTQICQ9uBYqX02tpvfAeBJbn2jaJ7qZEl5 8KiX/SEWvK+0PPxKDR1LgG3cXplgEvlfqdD/x05UY/9bPu2jbM4DcNEOo5TYKbnocT FnlTZ4Lr5Lb0imZJFe8+vUnSalH8VZUZtu0tJTy4e1ie5+pJffhI0oXN1BCAXKVW0B wYYt7dwyJF5dk+S/XQLEJyozvRkWp1qTm+FpxuwgUuhBSsiGb1cD4vInbuT9NbyAXi ln7S5CejYi73w== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 7AF2C442829; Wed, 16 Aug 2023 08:30:45 -0400 (EDT) Received: from pastel (unknown [45.72.228.154]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4CD4F120387; Wed, 16 Aug 2023 08:30:45 -0400 (EDT) From: Stefan Monnier To: Ihor Radchenko Cc: Tom Gillespie , "emacs-orgmode@gnu.org" , Bastien Subject: Re: org-assert-version considered harmful In-Reply-To: <87h6oznt28.fsf@localhost> (Ihor Radchenko's message of "Wed, 16 Aug 2023 11:08:15 +0000") Message-ID: References: <87h71ct10n.fsf@localhost> <87tu5bbajh.fsf@localhost> <87r10ey8ov.fsf@localhost> <87o7v4dvon.fsf@gnu.org> <87pmfijrvw.fsf@localhost> <87y1u4ec18.fsf@gnu.org> <871qqnjjdw.fsf@localhost> <87zgd85vc9.fsf@localhost> <87359yl2w5.fsf@localhost> <877cz7jucs.fsf@localhost> <87h6oznt28.fsf@localhost> Date: Wed, 16 Aug 2023 08:30:44 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Spam-Score: -10.79 X-Migadu-Queue-Id: 8487A500A8 X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: -10.79 X-TUID: 4tmYApi7MC/t Ihor Radchenko [2023-08-16 11:08:15] wrote: > Ihor Radchenko writes: >> Stefan Monnier writes: >>> BTW, rather than unloading, `package.el` relies on forcibly "re"loading >>> from the new version the already loaded files from the old version. >>> It suffers from a different set of problem :-( >>> [ I suspect `defvar` is the main problem for that solution. ] >> >> Could it be possible to force require use certain package version and >> automatically re-load a package when older version is being loaded? > > After trying several more approaches, [ Side note: did you keep notes about the various approaches you tried and their respective downsides? E.g. I'm curious what were the problems linked to my proposal of using a `require-with-check` like the one below my sig. ] > I now came up with yet another idea. Instead of fiddling with load > internals, compilation, or load-path, what about making sure that Org > libraries include version info directly? That should work. It implies a fair bit more churn in the code, tho, but I guess you plan to automate it via some scripts? Stefan (defun require-with-check (feature &optional filename noerror) "If FEATURE is not already loaded, load it from FILENAME. This is like `require' except if FEATURE is already a member of the list =E2=80=98features=E2=80=99, then we check if this was provided by a differe= nt file than the one that we would load now (presumably because `load-path' has been changed since the file was loaded)." (let ((lh load-history) (res (require feature filename noerror))) ;; If the `feature' was not yet provided, `require' just loaded the rig= ht ;; file, so we're done. (if (not (eq lh load-history)) res ;; If `require' did nothing, we need to make sure that was warranted. (let ((fn (locate-file (or filename (symbol-name feature)) load-path (get-load-suffixes)))) ;; If the right file was indeed loaded already, we're done. (if (assoc fn load-history) res (funcall (if noerror #'warn #'error) "Feature provided by other file: %S" feature) res)))))