all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* pcase is autoloaded?
@ 2013-02-27 22:42 Nic Ferrier
  2013-02-28  1:41 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Nic Ferrier @ 2013-02-27 22:42 UTC (permalink / raw
  To: emacs-devel

While testing code for the new emacswiki implementation the other day we
noticed that pcase is autoloaded.

This means that people leave it to be autoloaded rather than
specifically required. In our case it broke our test badly because our
file-system mock was loading pcase.el (which didn't work, surprise!)

Is this a good idea? I don't think so.


Nic Ferrier



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pcase is autoloaded?
  2013-02-27 22:42 pcase is autoloaded? Nic Ferrier
@ 2013-02-28  1:41 ` Stefan Monnier
  2013-03-01 21:48   ` Nic Ferrier
  2013-03-02  7:36   ` Aidan Gauland
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Monnier @ 2013-02-28  1:41 UTC (permalink / raw
  To: Nic Ferrier; +Cc: emacs-devel

> This means that people leave it to be autoloaded rather than
> specifically required. In our case it broke our test badly because our
> file-system mock was loading pcase.el (which didn't work, surprise!)

I have no idea what problem you bumped into.  I don't know what is your
"file system mock", nor do I know why loading pcase.el didn't work (or
why it should come as (no?) surprise).

> Is this a good idea? I don't think so.

Please give more concrete details,


        Stefan



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pcase is autoloaded?
  2013-02-28  1:41 ` Stefan Monnier
@ 2013-03-01 21:48   ` Nic Ferrier
  2013-03-02  2:59     ` Stefan Monnier
  2013-03-02  7:36   ` Aidan Gauland
  1 sibling, 1 reply; 6+ messages in thread
From: Nic Ferrier @ 2013-03-01 21:48 UTC (permalink / raw
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> This means that people leave it to be autoloaded rather than
>> specifically required. In our case it broke our test badly because our
>> file-system mock was loading pcase.el (which didn't work, surprise!)
>
> I have no idea what problem you bumped into.  I don't know what is your
> "file system mock", nor do I know why loading pcase.el didn't work (or
> why it should come as (no?) surprise).

We were running some tests in which the filesystem functions were
mocked with functions that returned predictable results for the function
under test.

These, of course, failed to load the pcase library when it was
autoloaded.



Nic Ferrier



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pcase is autoloaded?
  2013-03-01 21:48   ` Nic Ferrier
@ 2013-03-02  2:59     ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2013-03-02  2:59 UTC (permalink / raw
  To: Nic Ferrier; +Cc: emacs-devel

>>> This means that people leave it to be autoloaded rather than
>>> specifically required. In our case it broke our test badly because our
>>> file-system mock was loading pcase.el (which didn't work, surprise!)
>> I have no idea what problem you bumped into.  I don't know what is your
>> "file system mock", nor do I know why loading pcase.el didn't work (or
>> why it should come as (no?) surprise).
> We were running some tests in which the filesystem functions were
> mocked with functions that returned predictable results for the function
> under test.
> These, of course, failed to load the pcase library when it was
> autoloaded.

I have no idea why you say "of course".  And I see no connection between
`pcase' and your mockup.  What's special about pcase, as opposed to
other autoloaded functions/macros?


        Stefan



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pcase is autoloaded?
  2013-02-28  1:41 ` Stefan Monnier
  2013-03-01 21:48   ` Nic Ferrier
@ 2013-03-02  7:36   ` Aidan Gauland
  2013-03-02 22:30     ` Aidan Gauland
  1 sibling, 1 reply; 6+ messages in thread
From: Aidan Gauland @ 2013-03-02  7:36 UTC (permalink / raw
  To: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> This means that people leave it to be autoloaded rather than
>> specifically required. In our case it broke our test badly because our
>> file-system mock was loading pcase.el (which didn't work, surprise!)
>
> I have no idea what problem you bumped into.  I don't know what is your
> "file system mock", nor do I know why loading pcase.el didn't work (or
> why it should come as (no?) surprise).
>
>> Is this a good idea? I don't think so.
>
> Please give more concrete details,

Here is the relevant backtrace: https://gist.github.com/aidalgol/5070012

If pcase is not loaded when the test is run, this happens; if pcase *is*
loaded when the test is run, this error does not occur.  This does seem
to suggest that the autoloading of pcase causes a problem, but as Sacha
Chua pointed out (on #emacs), `fakir--expand-file-name' does not
correctly handle the a nil case, and calls `file-name-as-directory' with
nil.  (I do not know how that case should be handled.)

From what I can tell, pcase being autoloaded is not the problem, it's
just exposing a bug in fakir, and explicitly loading pcase before
running the above test only masks the problem.

Regards,
Aidan Gauland




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pcase is autoloaded?
  2013-03-02  7:36   ` Aidan Gauland
@ 2013-03-02 22:30     ` Aidan Gauland
  0 siblings, 0 replies; 6+ messages in thread
From: Aidan Gauland @ 2013-03-02 22:30 UTC (permalink / raw
  To: emacs-devel

Aidan Gauland <aidalgol@no8wireless.co.nz> writes:
> If pcase is not loaded when the test is run, this happens; if pcase *is*
> loaded when the test is run, this error does not occur.  This does seem
> to suggest that the autoloading of pcase causes a problem, but as Sacha
> Chua pointed out (on #emacs), `fakir--expand-file-name' does not
> correctly handle the a nil case, and calls `file-name-as-directory' with
> nil.  (I do not know how that case should be handled.)
>
> From what I can tell, pcase being autoloaded is not the problem, it's
> just exposing a bug in fakir, and explicitly loading pcase before
> running the above test only masks the problem.

Actually, scratch that.  It's not a bug in fakir; it's fakir being
called unexpectedly.  (Just talked with Nic in #emacs.)  This would
probably happen with any other autoloaded library, because fakir is
mocking (some of) the file functions.

In this particular instance, I think esxml, the library that's causing
pcase to be autoloaded, should explicitly `require' pcase.  For the
general case, I have no idea how to address.

Regards,
Aidan Gauland




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-03-02 22:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-27 22:42 pcase is autoloaded? Nic Ferrier
2013-02-28  1:41 ` Stefan Monnier
2013-03-01 21:48   ` Nic Ferrier
2013-03-02  2:59     ` Stefan Monnier
2013-03-02  7:36   ` Aidan Gauland
2013-03-02 22:30     ` Aidan Gauland

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.