[Top][All Lists]

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

Re: when to call provide, first or last?

From: Stefan Monnier
Subject: Re: when to call provide, first or last?
Date: Mon, 27 Feb 2012 08:35:21 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux)

> What's the accepted idiom for calling (provide 'foo-feature)?  I picked up
> the habit of calling it first in every library I write.  This way two
> libraries can call functions from each other without causing a circular
> dependency.

Actually, such mutual dependencies aren't desirable: sometimes they're
hard to avoid so we prefer to live with them, but that doesn't change
the fact that they're not good.

Putting the provide at the end makes sure that if featurep says t, then
it means thatthe feature is actually available, whereas if it's at the
beginning, featurep returning t only mean "we've started to lead the
feature, and well, maybe we've actually loaded it all by now, but I'm
not sure".

The difference is sufficiently unimportant to deserve bikeshedding,
I guess, but in any case, the convention is to put it at the end.
Like every convention, there can be exceptional circumstances that
justify doing it differently, but they have to be exceptional rather
than only based on taste.


reply via email to

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