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: seq.el and the complexity of Emacs Lisp. Date: Thu, 9 Nov 2023 13:02:50 -0800 Message-ID: <2879d846-b711-ada0-cdc4-9adcb4e56040@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24729"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Richard Stallman , paaguti@gmail.com, emacs-devel@gnu.org To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= , =?UTF-8?Q?Gerd_M=c3=b6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 09 22:03:59 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 1r1CBz-0006H0-Bc for ged-emacs-devel@m.gmane-mx.org; Thu, 09 Nov 2023 22:03:59 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r1CBB-0004gI-Fo; Thu, 09 Nov 2023 16:03:09 -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 1r1CB9-0004dp-Lw for emacs-devel@gnu.org; Thu, 09 Nov 2023 16:03:07 -0500 Original-Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r1CAz-0001vH-OU; Thu, 09 Nov 2023 16:03:06 -0500 Original-Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6c115026985so1400753b3a.1; Thu, 09 Nov 2023 13:02:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699563774; x=1700168574; 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=dml3iUbfQzWx0Ptyv8jBOUd+es92dp40BqocnhEbf+c=; b=By0O9gmFlNmxRIykOBnhPiAPmYhZ5E7q7WCerTc/Xs+qQSPmIAZfqyZl8U52JylKZ4 rxgzpK1SzLoq6jFcVYaz0J5ck2v6EFO/mZGsmlAAg9Kkw6ZkvK96IC++LSb7oPb7P+5v gE/i2OUGaJQ8wb1Zn/uIgKL8h6ZX5/RLporL/BHZ582L6wXy8DGbpc3fHv8ptoV2I9lr chDL4/Gx8yo7kzd1lI6Y1VGDIwfwAmRL4Ae7Hm2RQU3KNFiFJoctEdo6nhxkHyPfAXAx PxnecM6chXnK1/5M3ZQ3c/up7s4A/C/3OdlYrO8ggm0ChkqSC1PzxwqRy7LVZ/aacXQf CNsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699563774; x=1700168574; 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=dml3iUbfQzWx0Ptyv8jBOUd+es92dp40BqocnhEbf+c=; b=LfKKFjclq138CTNMXELCLVC+1zqSKx8nJknck90DqGap1g+A7754bp+oSa1MJu8qfz f8Q0G8lI/MeMY9VxT+WenBtjQp9CtmwXW5YdN9tvmPvnJgovvIX7sjYLgxUH9ZYyQhfe vJKNsE/VNeAx5KIK3VWZDwYWYY0frcvupgI3+CMI0ncegxP7kAgTL6P2suKtxGKVTRcn dbJxbRNxPcfvy+x73QEN4bL2CYDJt+lGwugO7Stizy8fsx1MzXSDuMs90dhRHj1jAF4r zYi/UAnjSFROprGv5QAz0UIk2bcBvIYSyhAg9LIzLSZc5H+ZqdZviC5NeqOZ9Q9txWEe k6rw== X-Gm-Message-State: AOJu0Yzen2CfnmW6RGY0JVbL7bqPgfGrFbFsXw+N3yyVwHALaujeA8hW wBsWqTOD9756VA6jjftHc64= X-Google-Smtp-Source: AGHT+IGfhVFi839W4ysVrnGY4GVO30syhj0vPxVDP9Etoi4R6lMAmSVa/6Wii04mPvbZusc8c57QLw== X-Received: by 2002:a05:6a00:1304:b0:6be:b79:eca with SMTP id j4-20020a056a00130400b006be0b790ecamr6309377pfu.32.1699563774270; Thu, 09 Nov 2023 13:02:54 -0800 (PST) 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 r19-20020aa78b93000000b006bf43e5619bsm11094228pfd.195.2023.11.09.13.02.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Nov 2023 13:02:53 -0800 (PST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=jporterbugs@gmail.com; helo=mail-pf1-x436.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 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:312444 Archived-At: On 11/7/2023 2:24 AM, João Távora wrote: > Presumably, it's good for handling custom sequence types, such as lazy > lists. That's a worthy goal, very worthy even, but this polymorphism comes > at a runtime cost, of course. And worthy as it may be, there's no use > of that feature in the Emacs tree (as far as I can tell from quick greps), > so it can't really be the "technical reason" for why seq.el is preloaded > and or recommended. I'd say this feature of seq is already in use, albeit not heavy use: Eshell uses some 'seq-FOO' functions in lisp/eshell/esh-var.el (specifically 'eshell-index-value') so that Eshell users can index into *any* sequence type, no matter what that type actually is. (Careful observers will also note that 'eshell-index-value' underscores one of seq.el's limitations: it doesn't work with rings, so Eshell needs to special-case that.) Overall, I think seq.el's abstractions are very useful, but perhaps they shouldn't be the only way to perform all the various algorithms they support. That is, seq.el is great when you want to accept any sequence type, but not so great if you know for sure that you have (say) a list. Some sort of type-annotation like Richard proposed could resolve this issue though: it would essentially allow us to turn what's usually a runtime dispatch into a compile-time dispatch. That's probably useful for all generic functions; not just seq.el.