emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Re: Improve `replace-regexp-in-string' ergonomics?


From: Drew Adams
Subject: RE: [External] : Re: Improve `replace-regexp-in-string' ergonomics?
Date: Wed, 22 Sep 2021 23:24:36 +0000

> Probably check that the number of &rest arguments divides by two as
> well. Or three, or four? 

Giant apologies for not following this thread,
especially if this comment makes no sense in
context.
___

My comment is that &rest is best used for an
_arbitrary_ set (list) of unknown length and
_unknown structure_.  Among other things,
that allows for adding more, possibly
unrelated args later.

If instead you hard-code in the body an
expectation that the "rest" of the args will
be of a certain kind, in a certain order, or
in a certain kind of sequence (e.g. mod 2,
mod 3, with given meanings to each of the
pair or triplet items), then you lose this
property of &rest - which is an integral
part of its raison d'etre, IMO.

If you know the structure you want, and you
just want to allow it to have indeterminate
length, then use a single list arg (required
or optional), and specify in the doc string,
and control in the body, the actual form of
the list elements (e.g. triplets of a given
form).

Abusing &rest the way I think you might be
suggesting will ultimately bite you.  And
the more you do it, the  more it will bite
you elsewhere.  Users won't know what to
expect, or they'll have unreasonable
expectations.

Just one opinion.  Again, sorry if not on
the real topic.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]