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: [elpa] externals/transient 667ce2b287 18/23: Use transient-default-value in transient-init-value(suffix) Date: Thu, 26 Dec 2024 15:34:55 +0100 Message-ID: <87wmfmikc0.fsf@bernoul.li> References: <173487507772.3820862.14263838078882905942@vcs3.savannah.gnu.org> <20241222134440.C5563C5C27C@vcs3.savannah.gnu.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="25400"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 26 16:13:01 2024 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 1tQpXp-0006QL-Mq for ged-emacs-devel@m.gmane-mx.org; Thu, 26 Dec 2024 16:13:01 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQpXM-0001vN-Vt; Thu, 26 Dec 2024 10:12:33 -0500 Original-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 1tQoxF-0004LU-KC for emacs-devel@gnu.org; Thu, 26 Dec 2024 09:35:13 -0500 Original-Received: from mail.hostpark.net ([212.243.197.30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQoxC-0001hy-J8 for emacs-devel@gnu.org; Thu, 26 Dec 2024 09:35:13 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 7F843164AE; Thu, 26 Dec 2024 15:34:58 +0100 (CET) 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; s=sel2011a; t=1735223698; bh=OjQx6Iz8uxNoLwqqkjUvel3xCYYXPq8oUCU67oHyhcI=; b= J2z2GOb18klBjz2u4MFB/R7Is2qsAntIBnHWuFTEUrHZt+61GsjkSt8IvmmItnPq GbFvibiegmeeb7dV+wDmzrbunM30cdDPugxn0xrcd/QyBgsvLidAmiRoujOCT97A ITQZvXmeCReg8WQqR6YDBlueh2utUa+12Vytr2mwoRA= 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 v8MkVGZ7iurA; Thu, 26 Dec 2024 15:34:58 +0100 (CET) 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 (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id E674F16466; Thu, 26 Dec 2024 15:34:57 +0100 (CET) In-Reply-To: Received-SPF: pass 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.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 26 Dec 2024 10:12:30 -0500 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:327152 Archived-At: Stefan Monnier writes: > Hi Jonas, > >> --- a/lisp/transient.el >> +++ b/lisp/transient.el >> @@ -3331,9 +3331,13 @@ Use `transient-default-value' to determine the default value." >> (cdr saved) >> (transient-default-value obj))))) >> >> -(cl-defmethod transient-init-value ((_ transient-suffix)) >> - "Non-infix suffixes usually don't have a value, so this is a noop." >> - nil) >> +(cl-defmethod transient-init-value ((obj transient-suffix)) >> + "Non-infix suffixes usually don't have a value. >> +Call `transient-default-value' but because that is a noop for >> +`transient-suffix', this function is effectively also a noop." >> + (let ((value (transient-default-value obj))) >> + (unless (eq value eieio--unbound) >> + (oset obj value value)))) >> >> (cl-defmethod transient-init-value ((obj transient-argument)) >> "Extract OBJ's value from the value of the prefix object." >> @@ -3379,6 +3383,11 @@ that. If the slot is unbound, return nil." >> default) >> nil)) >> >> +(cl-defmethod transient-default-value ((_ transient-suffix)) >> + "Return `eieio--unbound' to indicate that there is no default value. >> +Doing so causes `transient-init-value' to skip setting the `value' slot." >> + eieio--unbound) >> + >> ;;;; Read >> >> (cl-defgeneric transient-infix-read (obj) > > Why use `eieio--unbound` (i.e. a variable internal to EIEIO) rather than > your own magic placeholder? I first used `eieio--unbound' "manually" (in another package), when it was still named `eieio-unbound'. When you made that breaking change, I quickly added the necessary backward compatibility alias to that package. I have (in a later) commit done the same here. (I briefly forgot that this is not the package in which I had already been using this symbol. This may have contributed to me using this symbol here; I though I was already using it.) The reason I am using Eieio's "this is not bound", is that I am doing an Eieio thing here. It's not a "not bound" slot but the "not bound" return value of a generic function, which isn't the same thing, but pretty damn close. Sure I can invent a new symbol just for this one case, but it would be (IMO unnecessary) noise and the only reasons I would be doing it is to make you happy and to avoid having a conversation about it. > IOW, is there a good reason to break the abstraction here? I am not sure what "the abstraction" and "here" refer to exactly.