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

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

Re: Why is booleanp defined this way?


From: Tassilo Horn
Subject: Re: Why is booleanp defined this way?
Date: Sat, 18 Apr 2015 08:13:26 +0200
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Marcin Borkowski <address@hidden> writes:

Hi Marcin,

> Of course, this "normalizes" any "truthy" value to "t", but is it
> really needed for anything (except perhaps being elegant)?

It's just as you say and the others already explained.  And then have a
look where and `booleanp` is actually used.  Basically all usages in
emacs itself are

  (put 'some-variable 'safe-local-variable 'booleanp)

So some-variable is safe as a file-local variable only if it is either
nil or t but it is not safe when its value is (eval (shell-command "rm
-rf ~/")).

Another use-case is when you are talking to some external service that
wan't "real" (aka, non-generalized booleans) and use some marshalling
code which automatically converts nil to false and t to true.

Bye,
Tassilo



reply via email to

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