unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Heime via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: Tassilo Horn <tsdh@gnu.org>
Cc: Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Re: Symbols or strings as arguments
Date: Thu, 28 Nov 2024 11:59:20 +0000	[thread overview]
Message-ID: <UZf-ZRQHpp9I9hIN1hPt7MOWvJpfXy7hMJzqia7ieupLod8SuEZD3hvnW9Q57EMcKhM4-IcoaTFzD-0ZPUWiIs7h5lXB-HC1YUvbtcLj85o=@protonmail.com> (raw)
In-Reply-To: <87cyifq5rp.fsf@gnu.org>






Sent with Proton Mail secure email.

On Thursday, November 28th, 2024 at 5:36 PM, Tassilo Horn <tsdh@gnu.org> wrote:

> Heime via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org 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. --- Tassilo

Focusing on arguments for dispatching commands on them using case, pcase, 
cond, I shall use keywords and symbols to be immediately visible their 
special meaning.



      reply	other threads:[~2024-11-28 11:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-27 15:05 Symbols or strings as arguments Heime via Users list for the GNU Emacs text editor
2024-11-28  5:36 ` Tassilo Horn
2024-11-28 11:59   ` Heime via Users list for the GNU Emacs text editor [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='UZf-ZRQHpp9I9hIN1hPt7MOWvJpfXy7hMJzqia7ieupLod8SuEZD3hvnW9Q57EMcKhM4-IcoaTFzD-0ZPUWiIs7h5lXB-HC1YUvbtcLj85o=@protonmail.com' \
    --to=help-gnu-emacs@gnu.org \
    --cc=heimeborgia@protonmail.com \
    --cc=tsdh@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).