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

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

Re: What does ":noerror" do?


From: Pascal J. Bourguignon
Subject: Re: What does ":noerror" do?
Date: Sun, 13 Oct 2013 01:06:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Xue Fuqiao <xfq.free@gmail.com> writes:

> Hi,
>
>>From a recent post in emacs-devel[fn:1], I found a usage like this:
>
> (message "Loading Emacspeak...%s"
>          (if (load "emacspeak-loader" :noerror) "success!" "FAILED!"))
>
> I'm not sure what the ‘:noerror’ is.  It seems that the ‘:noerror’ is
> just like a random symbol, like ‘(quote noerror)’, but I could't find this
> kind of usage in lispref.  Any ideas?


It is a lisp object that is not the symbol nil, and therefore that is
true.  That's all it takes for a boolean argument.

The doc is quite clear about it:

    If optional second arg NOERROR is non-nil,
    report no error if FILE doesn't exist.

Now this is what it does to the emacs processor.


The question is what it does to the programmer mind of the human
readers?


I could not say about people in general.  It sure looks like it confused
you.  I can tell that I think it should inspire TERROR in every
programmer minds.  Think about it:

      (load file nil :noerror nil :nosuffix)


At least, in Common Lisp we'd use keyword arguments writing something
like:

    (load file :verbose t :print nil :if-does-not-exist nil
               :external-format :utf-8)

and if a typo or wrong keyword is given, the function can easily and do
signal an error.



But with optional arguments, the programmer must ensure that the
parameter are given in the right order, and using keywords for true
booleans may confuse this, and impact a different meaning to the
programmer than to the compiler.  Terror should ensue.

-- 
__Pascal Bourguignon__
http://www.informatimago.com/


reply via email to

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