From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: What's missing in ELisp that makes people want to use cl-lib? Date: Sun, 12 Nov 2023 22:07:32 -0500 Message-ID: References: <25924.21015.19614.951576@orion.rgrjr.com> <87bkc4jpja.fsf@dataswamp.org> <8a7362da-3cc4-221c-7b8a-a9918677adff@gutov.dev> <877cmox1nr.fsf@web.de> Reply-To: rms@gnu.org Content-Type: text/plain; charset=Utf-8 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34643"; mail-complaints-to="usenet@ciao.gmane.io" Cc: michael_heerdegen@web.de, emacs-devel@gnu.org To: =?iso-8859-1?Q?Jo=C3=A3o_T=C3=A1vora?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 13 04:08:33 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 1r2NJR-0008nD-9U for ged-emacs-devel@m.gmane-mx.org; Mon, 13 Nov 2023 04:08:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2NIW-0005WC-CL; Sun, 12 Nov 2023 22:07:36 -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 1r2NIU-0005V1-Dd for emacs-devel@gnu.org; Sun, 12 Nov 2023 22:07:34 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r2NIT-0007wd-29; Sun, 12 Nov 2023 22:07:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=o2EVZrdafthLthdCptHHc2gRmTOVXfawMMjbULnEIPw=; b=Rli3x1JaoAcf UdLP3W9YKm6SCpWfwVOevtSWjE1p++gkkMAhV/BfBqoADsRrg0LNlRmMfaJUV3P/nCmotpKT74kmR drtxfnDPZaQSCsEfGJFpwXmONc5o6gBKY/XfxrI3f5B51l9TanPTy24ZuVA+1GrATofrHhJSg3lwM BRTyUwZVIAht9e4qn5jnskM+sp9FCeuBawy1AqkJkEtw2lQRWkMMfh1ItMpus2Tivy+AX2ySXckI1 zTlOjfyRc2QX8L6uwm3yHoHstdi/5rEywXZGLZO5IkVhQNhE/KWZHRoDZNfl3FjLxWSjUgi2DvH6Q NqDFBk326jSEhPaaRNYWMA==; Original-Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1r2NIS-0004DC-Fx; Sun, 12 Nov 2023 22:07:32 -0500 In-Reply-To: (message from =?iso-8859-1?Q?Jo=C3=A3o_T=C3=A1vora?= on Sat, 11 Nov 2023 12:50:21 +0000) 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:312684 Archived-At: [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > I think these keyword arguments are just like normal elisp > optional arguments, they are just passed by name. So the > same problems of writing/explaining them apply. > As to whether keyword arguments are intrinsically needed more > or less frequently than optional arguments is IMO, very > debatable, and entirely dependent on the function. I think both of these questions are minor issues that threaten to act as red herrings. Keyword arguments are better than optional positional arguments in some circumstances, and the optional positional arguments are better in some circumstances. Keyword arguments are better -- sometimes much better -- when one function accepts many different optional arguments. There are functions in Emacs that accept many positional optional arguments, and some of them would be cleaner if they accepted keyword arguments. Why don't they? Because Emacs Lisp doesn't make it easy to accept keyword arguments. It is especially a pain in a primitive. And many of those functions were defined before Emacs Lisp had such a thing as a keyword, let alone a keyword argument. On the other hand, positional optional arguments are better when a function accepts only one or two of them and they are used often. They are easier to pass, and easier to remember, Keyword arguments are easier to use when a function accepts many different arguments pass. But this can backfire when it encourages people to give a function many keyword arguments, on the assumption that "It doesn't cost us anything to give it more." It may not cost much more at run time to decode those arguments, but it costs a lot more to remember what they do, and to use them. What Common Lisp did to sequence functions was the worst of everything. It gave a set of many keyword arguments to functions which didn't have any, then changed the defaults for those functions so that one usually needed to pass those keyword arguments, -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org)