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

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

bug#57673: [PATCH] Parse --help messages for pcomplete


From: Stefan Monnier
Subject: bug#57673: [PATCH] Parse --help messages for pcomplete
Date: Wed, 14 Sep 2022 17:45:34 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

>> Tho to be perfectly honest, I think any keyword argument whose default
>> value is not the same as nil is a problem (I know, sometimes there can
>> be good reasons for that, but we should try to avoid them as much as
>> possible).
> Hum, that's a strong claim, and if I heard it from a clean code
> influencer I would be rather suspicious.  So I'm curious why you think
> that way.

It's convenient for the callers to know that they always pass nil to
mean "use the default".

It lets you write:

   (bar baz :hello foo)

instead of

   (if foo
       (bar baz :hello foo)
     (bar baz)

which gets really tiresome when you have more than 1 such keyword arg to
(maybe) pass to the function.

But my opinion is also influenced by the convenience of having only
`put` and `get` and knowing that there's no difference between a nil
property and a property that's absent.  Same holds for alists where it's
really convenient to try and stick to the principle that absent entries
are equivalent to entries associated to nil.

The convenience comes mostly from the fact that it's pervasive, rather
than from any specific use case.


        Stefan






reply via email to

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