From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.devel Subject: Re: What's missing in ELisp that makes people want to use cl-lib? Date: Sat, 28 Oct 2023 14:03:29 -0700 Message-ID: <6f9dba21-1e90-2cd1-2775-a9bde3d0188f@gmail.com> References: <83ttqnm4ti.fsf@gnu.org> <831qdlpoye.fsf@gnu.org> <83sf5xhnym.fsf@gnu.org> <871qdhk49w.fsf@dataswamp.org> <25914.49745.111873.734458@orion.rgrjr.com> <8334xud0fl.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6742"; mail-complaints-to="usenet@ciao.gmane.io" Cc: stefankangas@gmail.com, rms@gnu.org, rogers@rgrjr.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Oct 28 23:04:25 2023 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 1qwqTo-0001VQ-Mp for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Oct 2023 23:04:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwqT7-0000KB-Ku; Sat, 28 Oct 2023 17:03:41 -0400 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 1qwqT1-0000J3-26 for emacs-devel@gnu.org; Sat, 28 Oct 2023 17:03:35 -0400 Original-Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qwqSz-000131-BL; Sat, 28 Oct 2023 17:03:34 -0400 Original-Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-5b980391d70so138002a12.0; Sat, 28 Oct 2023 14:03:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698527011; x=1699131811; darn=gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=VB/8eIHC+k7zK6r94yuDfKjd7EdU8g4Xji8QYN07wMc=; b=j0Vgrz7F8TiODNOkRoeHdTwkNJ9MFTo9dEFLY/PN5QDxsi8uD79p5AesuiBNCJuKHK Sl4JXZ4N1RA5JOIxg0otJcLSai4pT1Pk/IDhGg6NzLumGwoE9hmZdZ92rBZJWqOaDzEw oKmKYgizri/QgdVnk0YQMRiUqTVjIlj+VA/9PID7TWVhhkP+wzDCFtCriLLpZcFxhVkH prmgi2xnua7S9MtXdZByHwiFpWZAQSdZ7bsO2DrlW4VnGA2VEaRvzhEcffw06sLmBuKz dOHTtZCfIicF9HU54+V13l1TetzxzunQ8TYvFZYjkx/p5FfzgGOJ6bMJGDFOzmYO4caf I1KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698527011; x=1699131811; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VB/8eIHC+k7zK6r94yuDfKjd7EdU8g4Xji8QYN07wMc=; b=eZGm0N1pn/AbpiQYmDye5k8qrBvBKQ/hxqDq8AHUOeBsP6On+V77B5/xlr+0YqnaTG cJctpCs9B5bdJ6JVr+fFsPl5VszQr9+sC6hXHjwHq69SfHOWI2dtTmt+cNESRqY3Mx3h eGCm+DpgHN0yCAAtXyHmoz23GBFd4t06CKJ+xFaQA/OXqTazGk0LW7F2Y/Qejf0F1tzY LSZGe25OoO9iYARSMv7y/e/iSTMyln6IDQh+mPAGWu6B5TLdcwZA459ZXftO9LHE86DX +bC87iRMsQH/RT/IyrAVNKIj2O90u3sUGzLPbBPWJBY3nKpU/iqxkGkmu/kK428BeCC5 THnw== X-Gm-Message-State: AOJu0YxxzO+pepHblgGRbZsadI0OPYfZtP9a1GmWefcDtRk4x1iZNoqO 6EMbFHv9n727Xk2uD9zkmbatLlFeYo4= X-Google-Smtp-Source: AGHT+IFmVRYri3KFjgQHHCyt1+1mhOFoMVTPmyYpMxOewUCd4A94r+44GvV4DLv9b+ql4F9uQjwURQ== X-Received: by 2002:a17:902:c78c:b0:1b8:954c:1f6 with SMTP id w12-20020a170902c78c00b001b8954c01f6mr5730602pla.36.1698527010709; Sat, 28 Oct 2023 14:03:30 -0700 (PDT) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id 34-20020a17090a09a500b002804af3afb7sm643pjo.49.2023.10.28.14.03.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 28 Oct 2023 14:03:30 -0700 (PDT) Content-Language: en-US In-Reply-To: <8334xud0fl.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=jporterbugs@gmail.com; helo=mail-pg1-x52a.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:311966 Archived-At: On 10/28/2023 12:14 PM, Eli Zaretskii wrote: >> Date: Sat, 28 Oct 2023 12:10:23 -0700 >> Cc: emacs-devel@gnu.org >> From: Jim Porter >> >> I agree with this. I can speak about Eshell in particular, since it's >> historically used a bit of cl-lib, and I've added more usage to it. >> >> By far the number one cl-lib thing Eshell uses is 'cl-assert'. > > cl-assert is a macro in cl-macs, so it isn't relevant to this > discussion. Thanks. I wasn't aware of this distinction. (I see that it was discussed elsewhere in the parent thread, but that thread is very big and I hadn't been following it closely.) Is there any benefit in aliasing macros like this to non 'cl-FOO' names anyway? As a mere consumer of the various Common Lisp code in Emacs, it's not always clear to me what's ok to use versus what should ideally be avoided. >> Finally, Eshell uses a few miscellaneous cl-lib functions, some of which >> are probably necessary, and some of which are just conveniences. The >> (probable) necessities are: cl-progv and cl-mapc. The conveniences are: >> cl-loop, cl-flet, cl-list*, cl-remove-if, cl-incf, and cl-decf. > > These are the only ones relevant to this discussion. I see that 'cl-progv' is in cl-macs.el, so I guess that's not relevant. 'cl-mapc' is in cl-extra.el, which I suppose is relevant here? I find it very helpful, but I'd be happy with any function/macro that would make it easy to iterate over multiple sequences at once. Of the conveniences, I think the ones I'd miss the most are 'cl-incf' and 'cl-decf', which I use in Eshell for recounting some handles. (I could possibly rewrite that code to let the garbage collector do all the work, but that code interacts with some of the trickier bits in Eshell, so maybe it's best not to change it too much.) 'cl-remove-if' should be easy to replace with 'seq-filter' or somesuch. Likewise 'cl-list*' with 'nconc'. I know there's some controversy around 'cl-loop' (I'm not a big fan myself), and I've thought about adding some new hooks to Eshell that would probably obviate the need for 'cl-loop' (which is used in em-extpipe.el). So in conclusion, I guess the relevant functions that I care about are 'cl-mapc', and to a lesser degree 'cl-incf'/'cl-decf'. Everything else could go away if we wanted to avoid them.