From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: Symbols or strings as arguments Date: Thu, 28 Nov 2024 06:36:10 +0100 Message-ID: <87cyifq5rp.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35520"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.12.7; emacs 31.0.50 Cc: Heime To: Heime via Users list for the GNU Emacs text editor Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 28 06:36:52 2024 Return-path: Envelope-to: geh-help-gnu-emacs@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 1tGXCu-00096S-N3 for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 28 Nov 2024 06:36:52 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGXCM-0003fM-0U; Thu, 28 Nov 2024 00:36:18 -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 1tGXCK-0003f6-DC for help-gnu-emacs@gnu.org; Thu, 28 Nov 2024 00:36:16 -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 1tGXCK-0005YB-5T; Thu, 28 Nov 2024 00:36:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=1AU1PZ7/vL+ChqLhtQQ/87R7p8ARlZUOLhSLe+Loieo=; b=aV7dEnzj3df2iwPQQSnb EfSg08WMjI9qm8+7kCvumFIrriNc4GTjW74B5PVU12QqJ9xp2hMFlvMXtvtsYLofbvDMirkvJwzTU Im8D6yNsseyoVTQ3VjBkhnJPvfyki3VUfdloN2faQBzMcK5c3yQ9TaYTkettXLwL5OFxTdnFp8eJP Pcz/hIPQlS+C1oRpykBG5VKoRYoQNoeUCplqWJtLWTqC3Rb8qHSKGUWUpUvYpUOnO35FaNCnGZ0ox vyelmzTTsbudBC9Eek2UlQKd4ZfUuoIzzyuERjNY2SWoV9JgtzdFUeoyLPwGA5iWnzSFtxqSr0VAI uuycx3IU8VtQEg==; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrhedtgdekfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefhvfevufgjfhgffffkgggtsehttdertddtredtnecu hfhrohhmpefvrghsshhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqnecugg ftrfgrthhtvghrnhepleduvdegfeduvdejkeefteelgeetgfevhefhueffueffgeehgfeu fefgvdffgedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhrnhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeeijeef keejkeegqdeifeehvdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrihhlrd hfmhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohep hhgvihhmvggsohhrghhirgesphhrohhtohhnmhgrihhlrdgtohhmpdhrtghpthhtohephh gvlhhpqdhgnhhuqdgvmhgrtghssehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: ib2b94485:Fastmail In-Reply-To: (Heime via Users list for the's message of "Wed, 27 Nov 2024 15:05:18 +0000") X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:148425 Archived-At: Heime via Users list for the GNU Emacs text editor writes: > I wonder whether developers would preferentially use symbols rather > than strings in arguments. > > Consider calling (cupola '(72 tabtrail local)) versus (cupola '(72 > "tabtrail" "local")) Obviously, it depends. If the arguments are essentially an enumeration, i.e., the possible/allowed values are just a small set, then I'd use symbols or keywords. E.g., an argument location with possible values local and remote => :local / :remote. An argument first-name, well, that's a string because it can be anything. It also depends on the usage of the argument. If you just print it out, a string is fine. If you dispatch on it (using case, pcase, cond), keywords and symbols are probably better. Mostly because they stand out a bit and it's immediately visible that they have special meaning affecting the control flow. Bye, Tassilo