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 12:10:23 -0700 Message-ID: References: <83ttqnm4ti.fsf@gnu.org> <831qdlpoye.fsf@gnu.org> <83sf5xhnym.fsf@gnu.org> <871qdhk49w.fsf@dataswamp.org> <25914.49745.111873.734458@orion.rgrjr.com> 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="8431"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Kangas , rms@gnu.org, Bob Rogers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Oct 28 21:11:10 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 1qwoiE-00025B-Ek for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Oct 2023 21:11:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwohb-0007CN-TL; Sat, 28 Oct 2023 15:10:31 -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 1qwoha-0007C4-Dn for emacs-devel@gnu.org; Sat, 28 Oct 2023 15:10:30 -0400 Original-Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qwohY-0006qw-S6; Sat, 28 Oct 2023 15:10:30 -0400 Original-Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-5b980391d70so97912a12.0; Sat, 28 Oct 2023 12:10:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698520225; x=1699125025; darn=gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=NY9P/STRhiWsJ7hyuqdg7l0gqj3r2UTk+3gB2ONzxzs=; b=gz97KimGEOqGdv/i17QUHZK0GBAvEmRAzqwPHKc16jd9ZoNYt3MqFjYoy562kJ3NAV JMYW5gz+870mt7qLczDWQDzP/I/Zp8e1ZCI4BOw+soIReidiTfgJZvqSwdye8s6nF3pa D4sksZSh/fhlGA3fd3jhfYUoTGLYdUvTx6VpTopUkq0xISWwHdzxvnpttJsHWNN1A2kh kKYVAPnVVjG5+aiaGOshOlrZmM5h28pIIgC6PXoi0BXm+u+5sc2f7gfFFgxv6Q8nLAPc 61q4URLdPO+OhgIB59tFTN/ptxCkGziQrK265E7mC26riHerddxagj7VBpLjS3yDp5gU XCpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698520225; x=1699125025; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NY9P/STRhiWsJ7hyuqdg7l0gqj3r2UTk+3gB2ONzxzs=; b=Q3P9hEeUYRseNfhttNk2sUqXBCMikEdREYEdnspXlWfjIE5eHb3QpdZ6N4+S5MR3BG 9r0VhIDdlNfLl+WbznembMzWUCG5R8Tprt73P8zuoN6RH0z5duV5zuGjqt7srMo6j5ed 8o3BCVXeE2dd7JF4MlLK0J3WJHmezfHnCCvSQvii2o4ouxdnDuKuvFyyWbIVO4dKmbUz imzOPKe1Ae4wgB9SzYYUdBFjxWhwCKIWceFuG2p21++si03u45IP5Iju67W6YGAsiHAJ klXx1jrkEpr0k+tat/LWcGFkMWpADaPcFnciVhzMOrb3aNQJ4Upe8NiYUft81By9qF4j TmvQ== X-Gm-Message-State: AOJu0YyxFcf57cupdPi3AmwHVlBI2RtTW9KPGOhuVfyvplAqQ9XsbhSr +QZ1m3K8Kr1WDkTXpQAp+w+GEdFPUSc= X-Google-Smtp-Source: AGHT+IFXBG/k96qVBauD61y36Rg8FvrWoYr1UT+SU0d5yKv8qyRhW7FE/43OkCRpKKucD/PRDWOkhA== X-Received: by 2002:a17:902:bd05:b0:1c7:5f03:8562 with SMTP id p5-20020a170902bd0500b001c75f038562mr5578126pls.30.1698520225268; Sat, 28 Oct 2023 12:10:25 -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 r9-20020a170902be0900b001c3be750900sm3522018pls.163.2023.10.28.12.10.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 28 Oct 2023 12:10:24 -0700 (PDT) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=jporterbugs@gmail.com; helo=mail-pg1-x52b.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:311961 Archived-At: On 10/28/2023 8:39 AM, Stefan Kangas wrote: > Is it possible that certain abstractions or functions are filling a gap > in Emacs Lisp itself? In the case of `cl-pushnew', I happen to think > that the answer is yes. 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'. This would be reasonably easy to do without cl-lib, but it's a pretty convenient syntax for, well... asserting some precondition for a function. That's been useful for helping to identify subtle bugs in Eshell's logic. After that, the next most important cl-lib thing (in my opinion) is generic functions. I introduced this in Eshell to break apart some monolithic I/O code that had large 'cond' forms for each I/O target. Now, with generic functions, they're separate, and it's much easier for third parties to add new I/O target types. In the future, I'll likely use generic functions for a few more bits in Eshell. Related to the above is 'cl-defstruct'. That's useful for working with generic functions, but I think there's also some benefit to using them instead of lists (or alists/plists) when you want something with a very-specific set of members (similar to a C struct or C++ class). However, I could do without CL-style structs for this case, excluding the generic function side. 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.