From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jonas Bernoulli Newsgroups: gmane.emacs.devel Subject: Re: master 48aacbf292 2/2: Make many seldom-used generalized variables obsolete Date: Mon, 19 Sep 2022 01:10:23 +0200 Message-ID: <87bkrcqnxc.fsf@bernoul.li> References: <166111278304.2846.13033924580993120733@vcs2.savannah.gnu.org> <20220821201303.AD1E6C0088A@vcs2.savannah.gnu.org> <877d29hm53.fsf@melete.silentflame.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="40568"; mail-complaints-to="usenet@ciao.gmane.io" To: Sean Whitton , emacs-devel@gnu.org, Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 19 01:12:28 2022 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 1oa3Se-000AOg-6Y for ged-emacs-devel@m.gmane-mx.org; Mon, 19 Sep 2022 01:12:28 +0200 Original-Received: from localhost ([::1]:42168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oa3Sc-0003Ux-F5 for ged-emacs-devel@m.gmane-mx.org; Sun, 18 Sep 2022 19:12:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oa3Qj-0002j0-VZ for emacs-devel@gnu.org; Sun, 18 Sep 2022 19:10:29 -0400 Original-Received: from mail.hostpark.net ([212.243.197.30]:47078) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oa3Qh-0002Mb-Ur for emacs-devel@gnu.org; Sun, 18 Sep 2022 19:10:29 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 220C016595; Mon, 19 Sep 2022 01:10:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1663542623; bh=GVrYBGGL43PW5he9R09zypYy V82SqVFMdUyM/XzTZDw=; b=oRIV4tuGEDRyGkQ5ZaC7J53clv3/oI5S687dqMJs lLy74WuzzUh8YNc41QgsbbC7rDVx0HkcnWhG8+W3Xh49HVY8V0j6f9ThADmtC7xu oLwEeUnps0Yf0jLibn793or3skWizYacy3ihLwuZWf8jCxWFvP+Zy8Fk0fq6IyGy Oz4= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Original-Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id HlBTtDenMRiM; Mon, 19 Sep 2022 01:10:23 +0200 (CEST) Original-Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id D561D164DF; Mon, 19 Sep 2022 01:10:23 +0200 (CEST) In-Reply-To: <877d29hm53.fsf@melete.silentflame.com> Received-SPF: none client-ip=212.243.197.30; envelope-from=jonas@bernoul.li; helo=mail.hostpark.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:295609 Archived-At: I am a bit surprised Stefan Monnier is fine with these deprecation. If I remember correctly it was him who added the generalized variables, and back when he did it, I got the impression that there was more to come. I never used many of these, so I am generally fine with this change, just somewhat surprised. Unintuitive side-effects sounds like a good reason to deprecate them, on the other hand I don't necessarily agree that, e.g., (setf (point) n) is not intuitive, once you have wrapped your head around setf. But seeing that in the wild never-the-less felt a bit weird. > I found this in some code of mine, now generating warnings: > > (if (> (point) (mark)) > (progn (cl-incf (point)) (cl-decf (mark))) > (cl-incf (mark)) (cl-decf (point))) > > I guess the replacements would be forward-char and set-mark? Is there > anything simpler? As I understood it the idea behind generalized variables wasn't to use them mainly with setf, when a perfectly fine, explicit setter function exists; but to use them in situations like this, with other functions that understand generalized variables. Made sense to me when the feature was introduced. I guess I am just wondering whether generalized variables are generally seen as a failed experiment, and if so why exactly. Or if not, I would be interested in some guidance on when it is considered good practice to use them and when not. (Maybe we are going a bit overboard with the deprecations? Maybe we should instead focus on documenting potentially surprising effects. If we can think of reasonable use-cases (such as, IMO, the above) then maybe we should not deprecate. But again, I don't actually care that much, just expressing my surprise and resulting uncertainties. There is one generalized variable that I would like to see undeprecated though: (setf (buffer-local-value 'var buffer) val) That made a lot of sense to me. I don't look forward to having to wrap some (setq-local var val) with with-current-buffer again. And it appears I am not the only one you used buffer-local-value like this; 5% of the out-tree packages that I have installed use it, and they are not all authored by me. Jonas