help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Rationale behind conversion of a nil prefix arg to numeric 1


From: Andreas Röhler
Subject: Re: Rationale behind conversion of a nil prefix arg to numeric 1
Date: Tue, 6 Sep 2016 13:27:39 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Icedove/45.2.0



On 06.09.2016 11:45, Florian v. Savigny wrote:
   > Alternatively, for Andreas the axiom "the default value is always 0"
   > holds ;-P

I do sympathise with him, because my question started out supposing
exactly the same thing. It just seems intuitive that nil translates to
the number 0, if any, and when things are intuitive, this is (I think)
generally good.

It all becomes immediately clear when you understand that the numeric
prefix arg has a special purpose, i.e. is conceived as a repeat
counter (and NOT simply a number), but only then. In other words,
`prefix-arg-as-repeat-counter' might be the kind of name that would be
more readily understandable (and would even arguably be more accurate)
than `prefix-numeric-value'.

IIUC `prefix-numeric-value' is a more complex thing than providing a repeat counter - which it does for lower p.

prefix-numeric-value of C-u is 4 in contrast.

But let's go back to the simplest case of lower p in interactive spec:

What is easier to read/grasp

(setq counter (or arg 1)

or

(setq  counter (prefix-numeric-value arg))

IOW: in favor of avoiding these complex, tricky things. Let's have the code as explicit as possible.



reply via email to

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