From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: John Wiegley Newsgroups: gmane.emacs.devel Subject: Re: Include leaf in Emacs distribution Date: Fri, 23 Oct 2020 13:04:22 -0700 Message-ID: References: <87a6wrm5m0.fsf@gmail.com> <87blh6cfmz.fsf@gmail.com> <20201023.113723.2024617143609727683.conao3@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37157"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1.50 (darwin) Cc: caiohcs0@gmail.com, Naoya Yamashita , monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Stefan Kangas Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Oct 23 22:06:04 2020 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 1kW3K7-0009Sa-9R for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Oct 2020 22:06:03 +0200 Original-Received: from localhost ([::1]:50044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kW3K6-00040C-Bj for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Oct 2020 16:06:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kW3Ia-0003RD-6w for emacs-devel@gnu.org; Fri, 23 Oct 2020 16:04:28 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:57592) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kW3IZ-0003Mv-RB; Fri, 23 Oct 2020 16:04:27 -0400 Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]:32785) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1kW3IZ-0003s1-Km; Fri, 23 Oct 2020 16:04:27 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 4139A27C0058; Fri, 23 Oct 2020 16:04:27 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 23 Oct 2020 16:04:27 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkedtgddugeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufgjfffkfhgfgggtsehttdertddtredtnecuhfhrohhmpeflohhhnhcu hghivghglhgvhicuoehjohhhnhifsehgnhhurdhorhhgqeenucggtffrrghtthgvrhhnpe fgtdfflefhgfeuheelhfefueevgeffveeggefhvefftdfgjeehgfegjeejudeihfenucff ohhmrghinhepnhgvfigrrhhtihhsrghnshdrtghomhenucfkphepjeefrddvvddtrddutd efrddvgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehjohhhnhifodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeikeejkedtle eggedqudejjeehfeekudeiqdhjohhhnhifpeepghhnuhdrohhrghesnhgvfigrrhhtihhs rghnshdrtghomh X-ME-Proxy: Original-Received: from localhost (c-73-220-103-24.hsd1.ca.comcast.net [73.220.103.24]) by mail.messagingengine.com (Postfix) with ESMTPA id C881F3280065; Fri, 23 Oct 2020 16:04:26 -0400 (EDT) In-Reply-To: (Stefan Kangas's message of "Fri, 23 Oct 2020 18:41:21 +0000") Mail-Followup-To: Stefan Kangas , Naoya Yamashita , caiohcs0@gmail.com, monnier@iro.umontreal.ca, emacs-devel@gnu.org 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:258392 Archived-At: >>>>> Stefan Kangas writes: > The leaf package, here proposed for inclusion, is superficially very similar > to use-package. I have therefore asked some questions regarding the > difference between `use-package' and `leaf': >> Do you see any other major benefits of leaf over use-package? Or the other >> way around? >> >> Could you explain why I would want to use one or the other (as a user)? >> >> Could you explain why Emacs would want to include one or the other (as >> developers)? > As far as I can tell, the above hasn't been clarified. Or perhaps I've > missed it. > Could you provide an answer to the above, even if only briefly? I will try to answer from the other side. Reading the leaf documentation, the two packages appear so superficially similar that it's hard to see the differences between them at first glance: - Both are declarative macros that turn user specified configuration into appropriate and efficient Lisp code for configuring packages. The choice of keywords is nearly identical in both naming and purpose. - I've heard the complaint that use-package is "larger and more complex". To which I would say that *any* package becomes more complex once it's been around for several years and has fielded the issues brought up by a large user base. It's a nearly universal truism that greenfield rewrites will be smaller and cleaner. - Here are the code counts for the two projects, although I have a hard time seeing this as an important distinction: use-package, without tests: Language Files Lines Blanks Comments Code Complexity ----------- --------- ------- ------- ---------- ------ ---------- Emacs Lisp 12 3008 432 539 2037 80 leaf, without tests: Language Files Lines Blanks Comments Code Complexity ----------- --------- ------- ------- ---------- ------ ---------- Emacs Lisp 1 1170 144 116 910 23 I'm not sure if the amount of reduction in such a small project justifies a near-but-not-quite rewrite. - use-package's approach to keyword handling, since the 2.0 rewrite, is 100% modular. This means anyone can add, drop or replace the meaning of a keyword without needing to change the implementation of use-package. Supporting this configurability is the main reason for its additional code size and complexity. It was done in this manner to allow 3rd party developers to extend the ecosystem with their own addon packages, rather than relying on a `defcustom' that could conflict with the user's own customizations. Thus, any new keywords provided by leaf (like :emacs) could easily be added to use-package with a use-package-leaf extension module, in the same way that we have modules for chords, delight, diminish, ensure, etc. If I exclude these extension modules, btw, lines of code is reduced by 300. - use-package is used by Spacemacs, and several of its features -- such as developer hooks for finer control over loading and initialization -- exist only for that set of users. What I care about more than the implementation is the interface. If leaf truly offers a better internal design, it should become the basis for use-package 3.0, rather than competing as a replacement. Alternatively, given how moduler use-package already is, a use-package-leaf addon could be written to introduce the desired changes in behavior that prompted a leaf rewrite. The "smallness and simplicity" of the two implementations shouldn't matter to users -- just that we get their configurations right. After all, we're talking about something that is <2k lines of code, and has no functionlity of its own; it merely expands a config block into other code! As long as users are able to rely on a consistent pattern for declaring their Emacs config, any further details should be the concern of emacs-devel alone. -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2