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

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

Re: Why is it not possible to use "nil" any more in init files ?


From: WJ
Subject: Re: Why is it not possible to use "nil" any more in init files ?
Date: Mon, 19 Jan 2015 10:31:42 +0000 (UTC)
User-agent: XanaNews/1.18.1.6

Stefan Monnier wrote:

> 99.9% of calls of the form (foo-mode nil) or (foo-mode) either were
> meant to enable the mode (the vast majority), or were meant to disable
> the mode (a minority, but not an insignificant one).
> 
> A small proportion of those calls were correct (because the context
> made sure that the mode was always either enabled or disabled), but
> after yet-another bug report of someone not understanding why his
> font-lock was not enabled in such and such circumstance, I decided that
> it was time to break the small proportion of those minority cases which
> expected (and with reason) the call to disable the mode.

> 99.9% of calls of the form (foo-mode nil) or (foo-mode) either were
> meant to enable the mode (the vast majority), or were meant to disable
> the mode (a minority, but not an insignificant one).
> 
> A small proportion of those calls were correct (because the context
> made sure that the mode was always either enabled or disabled), but
> after yet-another bug report of someone not understanding why his
> font-lock was not enabled in such and such circumstance, I decided that
> it was time to break the small proportion of those minority cases which
> expected (and with reason) the call to disable the mode.


Passing nil as an argument is not the same as passing no arguments.
Don't you know how to tell the difference?

This won't work:

(defun foo (&optional arg)
  (print (if arg arg "no arg. given")))


This will work:

(defun foo (&rest args)
  (if args
    (message "arg. is %s" (car args))
    (message "no arg. given")))

: (foo)
no arg. given
: (foo nil)
arg. is nil


When mediocre programmers bow to the wishes of the most ignorant users,
the result is indeed sad.


reply via email to

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