unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Le Wang <l26wang@gmail.com>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: when to call provide, first or last?
Date: Mon, 27 Feb 2012 21:09:36 +0800	[thread overview]
Message-ID: <CAM=K+iqM80cqiGqJAZ1=KfvKbiJXYD58ub+X2-O-VUECgEfKgg@mail.gmail.com> (raw)
In-Reply-To: <CAAeL0ST=0M9R_VamL0=pBUOJPeXi7kBwdvnEHEj1epVq21a-ng@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 837 bytes --]

On Mon, Feb 27, 2012 at 8:59 PM, Juanma Barranquero <lekktu@gmail.com>wrote:

> On Mon, Feb 27, 2012 at 13:47, Le Wang <l26wang@gmail.com> wrote:
>
> > Is there some disadvantage to calling it first that I'm not seeing?
>
> Try loading this file my-feature.el:
>
> ;;; starts here
> (provide 'my-feature)
> )
> (defun my-function ()
>  "")
> ;;; ends here
>
> with  emacs -Q -l my-feature.el, and you'll get:
>
> load-with-code-conversion: Invalid read syntax: ")"
>
> (featurep 'my-feature) => t
> (fboundp 'my-function) => nil
>

What happens next?  You have broken code, and you're either looking at the
backtrace or you get a ding.  How is this a problem?


> In other words, having `provide' at the end guarantees that the
> feature does not enter the feature list unless the file was correctly
> loaded.
>
>     Juanma
>



-- 
Le

[-- Attachment #2: Type: text/html, Size: 1494 bytes --]

  reply	other threads:[~2012-02-27 13:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-27 12:47 when to call provide, first or last? Le Wang
2012-02-27 12:59 ` Juanma Barranquero
2012-02-27 13:09   ` Le Wang [this message]
2012-02-27 13:25     ` Juanma Barranquero
2012-02-27 13:32       ` Le Wang
2012-02-27 13:44         ` Juanma Barranquero
2012-02-27 13:57           ` Le Wang
2012-02-27 14:05             ` Drew Adams
2012-02-27 13:35 ` Stefan Monnier
2012-02-27 13:42   ` Le Wang
2012-02-27 14:25     ` Stefan Monnier
2012-02-27 15:08     ` Harald Hanche-Olsen
2012-02-27 15:46       ` Le Wang

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAM=K+iqM80cqiGqJAZ1=KfvKbiJXYD58ub+X2-O-VUECgEfKgg@mail.gmail.com' \
    --to=l26wang@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=lekktu@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).