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: pcase defuns Date: Mon, 20 Dec 2021 23:15:01 -0500 Message-ID: References: Reply-To: rms@gnu.org Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22554"; mail-complaints-to="usenet@ciao.gmane.io" Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Andrew Hyatt Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 21 05:16:30 2021 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 1mzWZh-0005g4-Cv for ged-emacs-devel@m.gmane-mx.org; Tue, 21 Dec 2021 05:16:29 +0100 Original-Received: from localhost ([::1]:36010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzWZg-0006rS-9d for ged-emacs-devel@m.gmane-mx.org; Mon, 20 Dec 2021 23:16:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:37096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzWYH-0004kV-Ou for emacs-devel@gnu.org; Mon, 20 Dec 2021 23:15:01 -0500 Original-Received: from [2001:470:142:3::e] (port=35532 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzWYH-0000yh-BP; Mon, 20 Dec 2021 23:15:01 -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=YAsdjOrl5xKPEEsGFpthQByRh0xCB70sbXlQIfrycpg=; b=RhZkPA+Betpm ll1iQ4hW4auSTPcUKOna43nN5ebt87uGLqSTd0xmDVVA3256KTEOOA16HlPQ+Rde9gL7cIK80TDEX CQ/yRPvee5J76SJ1WmNEiEpngE5NMJBS40py+t263/FSSVoQX+JAFpCDr9G95LwjM124I5nq1mTAK e9rZtVQpOgcxxnJc/VBsF8qiRzYo2rDQNP9KoUnhSuHFQrbGQJRpCaN7vi17G499pnpjhs8msZJm3 bdqvoc3WPGAaBLqLYB4SYXy3cezeA4VcTBIpOVxcoejRQikrT0TdijTgKwobBEL6UB6Ia4iBaXT+C KDTwXb38PjQ8KyKjZu7LHw==; Original-Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1mzWYH-0000dL-GI; Mon, 20 Dec 2021 23:15:01 -0500 >Content-Type: text/plain; charset=Utf-8 In-Reply-To: (message from Andrew Hyatt on Sun, 19 Dec 2021 16:08:20 -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" Xref: news.gmane.io gmane.emacs.devel:282553 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. ]]] The idea of defining a function in pieces, scattered around one or more files, is attractive as regards writing them. But it creates an inconvenience for subsequent maintenance by other people. The first thing you're likely to do when you see a call to a function you don't know about is to find its definition. For a piecewise-defined function, "the" definition doesn't exist. It has a number of partial definitions, scattered around one file or perhaps multiple files. If you think it is helpful for clarity to put the code for handling various cases in various places in the file, no new construct is needed for that. You can define a function for handling each case, and put its definition in the place you want it. Then define one overall function (you can think of it as "generic") which detects the cases and calls those. This works with our tools. Let's contrast this with generic functions. A generic function has a single central definition which describes how to call it. It is easy to find that. Finding the definitions of all the methods may be difficult. You may need to grep for them. Calling the generic function selects a method by data types, and you can generally tell, for given arguments, what data types they have. You can probably tell that one method is the right one without seeing all the others and comparing them. Thus, generic functions cause one kind of inconvenience for studying a program, but avoids the other kinds. Let's not add any constructs that increase the level of complexity of genericness beyond this. -- 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)