Re: Default value of keyword arguments
Lassi Kortela 03 Nov 2019 21:44 UTC
> My only concern is a boolean-typed keyword where #t is the sensible default.
For me it's the opposite: that's the only case that doesn't concern me
at all :) Just flip the sense of the option. E.g. turn `nondestructive?`
(default #t) into `destructive?` (default #f).
I've written a lot of Emacs Lisp. Emacs uses a ton of optional arguments
in its core API (lamentably, they are all positional optional arguments
instead of keyword arguments - Emacs is one of the best case studies of
the mayhem that happens when a large system lacks keyword arguments).
Since ELisp doesn't support custom default values for optional args,
they all get `nil` by default. As a user of those APIs, that is always a
relief (especially knowing the opposite situation in Common Lisp, where
you must always be guessing and poring over manuals to check the default
for everything).