unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [elpa] externals/osm 05ac461360: Bail out earlier if dependencies are missing
       [not found] ` <20220510195750.558C1C01683@vcs2.savannah.gnu.org>
@ 2022-05-10 21:00   ` Stefan Monnier
  2022-05-10 22:07     ` Daniel Mendler
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2022-05-10 21:00 UTC (permalink / raw)
  To: emacs-devel; +Cc: Daniel Mendler

>     Bail out earlier if dependencies are missing

Better not signal such errors when loading the file, since the file might
be loaded for all kinds of reasons beside running its code.  In some of
those cases it can get loaded in an Emacs batch session.


        Stefan




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

* Re: [elpa] externals/osm 05ac461360: Bail out earlier if dependencies are missing
  2022-05-10 21:00   ` [elpa] externals/osm 05ac461360: Bail out earlier if dependencies are missing Stefan Monnier
@ 2022-05-10 22:07     ` Daniel Mendler
  2022-05-11  1:53       ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Mendler @ 2022-05-10 22:07 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel

On 5/10/22 23:00, Stefan Monnier wrote:
> Better not signal such errors when loading the file, since the file might
> be loaded for all kinds of reasons beside running its code.  In some of
> those cases it can get loaded in an Emacs batch session.

I agree that the global check is a code smell. In this case I don't
expect batch usage since we are talking about a mouse driven map
display. The alternative would be to replicate the check in all the
entry points to the package, the osm-mode, the autoloaded osm-*
commands, which would require more code.

Daniel



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

* Re: [elpa] externals/osm 05ac461360: Bail out earlier if dependencies are missing
  2022-05-10 22:07     ` Daniel Mendler
@ 2022-05-11  1:53       ` Stefan Monnier
  2022-05-11  6:34         ` Philip Kaludercic
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2022-05-11  1:53 UTC (permalink / raw)
  To: Daniel Mendler; +Cc: emacs-devel

Daniel Mendler [2022-05-11 00:07:31] wrote:
> On 5/10/22 23:00, Stefan Monnier wrote:
>> Better not signal such errors when loading the file, since the file might
>> be loaded for all kinds of reasons beside running its code.  In some of
>> those cases it can get loaded in an Emacs batch session.
> I agree that the global check is a code smell. In this case I don't
> expect batch usage since we are talking about a mouse driven map
> display.

Again, I'm not talking about running the code.  I'm talking about
loading the file.  E.g. loading the file in order to find out which
functions or variables it defines (this can happen for example during
completion of `C-h o`).

> The alternative would be to replicate the check in all the
> entry points to the package, the osm-mode, the autoloaded osm-*
> commands, which would require more code.

The "right" place for such checks is as soon as you know that you *will*
definitely encounter an error.

When the file is being loaded, you don't know yet that an error is
inevitable because you don't know yet whether the loaded code will
be called.


        Stefan




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

* Re: [elpa] externals/osm 05ac461360: Bail out earlier if dependencies are missing
  2022-05-11  1:53       ` Stefan Monnier
@ 2022-05-11  6:34         ` Philip Kaludercic
  0 siblings, 0 replies; 4+ messages in thread
From: Philip Kaludercic @ 2022-05-11  6:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Daniel Mendler, emacs-devel

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

> Daniel Mendler [2022-05-11 00:07:31] wrote:
>> On 5/10/22 23:00, Stefan Monnier wrote:
>
>> The alternative would be to replicate the check in all the
>> entry points to the package, the osm-mode, the autoloaded osm-*
>> commands, which would require more code.
>
> The "right" place for such checks is as soon as you know that you *will*
> definitely encounter an error.
>
> When the file is being loaded, you don't know yet that an error is
> inevitable because you don't know yet whether the loaded code will
> be called.

My understanding in this case is that the basic functionality of osm.el
requires efficient JSON parsing to be available.  Without this, the
package becomes "prohibitively slow" (at least according to bug#55278).

Perhaps it would be better to add a helper function that does the check
and issues an error/warning, and call this at all entry-points?



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

end of thread, other threads:[~2022-05-11  6:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <165221267003.11226.2207874159602256273@vcs2.savannah.gnu.org>
     [not found] ` <20220510195750.558C1C01683@vcs2.savannah.gnu.org>
2022-05-10 21:00   ` [elpa] externals/osm 05ac461360: Bail out earlier if dependencies are missing Stefan Monnier
2022-05-10 22:07     ` Daniel Mendler
2022-05-11  1:53       ` Stefan Monnier
2022-05-11  6:34         ` Philip Kaludercic

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).