all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Pascal J. Bourguignon" <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: What does ":noerror" do?
Date: Sun, 13 Oct 2013 01:06:06 +0200	[thread overview]
Message-ID: <87ob6uks2p.fsf@informatimago.com> (raw)
In-Reply-To: mailman.3905.1381618634.10748.help-gnu-emacs@gnu.org

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	other threads:[~2013-10-12 23:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3905.1381618634.10748.help-gnu-emacs@gnu.org>
2013-10-12 23:06 ` Pascal J. Bourguignon [this message]
2013-10-13  2:14   ` What does ":noerror" do? Drew Adams
2013-10-13  3:26     ` Xue Fuqiao
     [not found]     ` <mailman.3911.1381634813.10748.help-gnu-emacs@gnu.org>
2013-10-14  9:33       ` jack-mac
     [not found]   ` <mailman.3909.1381630514.10748.help-gnu-emacs@gnu.org>
2013-10-13 14:17     ` Pascal J. Bourguignon
2013-10-13 16:27       ` Drew Adams
2013-10-14 10:22         ` Xue Fuqiao
2013-10-12 22:57 Xue Fuqiao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ob6uks2p.fsf@informatimago.com \
    --to=pjb@informatimago.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.