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

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

Re: How to delete all nil properties from a plist?


From: Pascal J. Bourguignon
Subject: Re: How to delete all nil properties from a plist?
Date: Sun, 09 Aug 2015 04:18:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Emanuel Berg <address@hidden> writes:

> "Pascal J. Bourguignon" <address@hidden>
> writes:
>
>>>> NEVER put the then on the same line as the test!
>>>
>>> ... why?
>>
>> because it makes it confusing to read.
>
> I think it looks good. Often the condition is short
> (it should be short) so there is plenty of space to
> use on that line.
>
>> If you do that, we have to count the parentheses!!!
>
> Why, and when?

Compare those two forms:

         (if (and (some-predicate-p a) (= a 1) (print (list a (some-function 
a))))
            (print b))
         (if (and (some-predicate-p a) (= a 1)) (print (list a (some-function 
a)))
            (print b))


and then compare those two forms:

         (when (and (some-predicate-p a) (= a 1) (print (list a (some-function 
a))))
            (print b))
         (if (and (some-predicate-p a) (= a 1))
            (print (list a (some-function a)))
            (print b))



> I have done that all the time and not once counted
> parentheses:
>
>     (if nil-prop (setq nil-prop nil)
>       (setq new (cons x new)) )

This is very bad style.


-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


reply via email to

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