ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@freedom.nl>, Max Chernoff <mseven@telus.net>
Subject: Re: No error when loading a non-existent module
Date: Thu, 25 Aug 2022 08:57:19 +0200	[thread overview]
Message-ID: <81c7bf84-81b0-d144-27bb-d0527e3b9e22@freedom.nl> (raw)
In-Reply-To: <f9754292710b11317106371e9778e6f9eae40b5f.camel@telus.net>

On 8/25/2022 2:19 AM, Max Chernoff via ntg-context wrote:
> Hi all,
> 
> If you load a non-existent module, ConTeXt issues a minor warning, but
> otherwise proceeds as normal:
> 
> MWE:
> 
>     \usemodule[doesnt-exist]
>     
>     \starttext
>     Hello world!
>     \stoptext
>     
> I think that this behaviour should be changed so that a fatal error is
> issued when a loaded module cannot be found. Plain TeX, LaTeX, and OpTeX
> all throw an error whenever their versions of modules cannot be found, so
> ConTeXt is the odd one out here.
> 
> There are 3 scenarios that I can think of for when you attempt to load a
> module, but it cannot be found:
> 
> 1. A module provides some new command "\somecommand"
> 
>     In this case, loading the module will quietly fail, but an undefined
>     control sequence error will be issued whenever you use
>     "\somecommand". This disguises the root problem, which is that the
>     module was never loaded, potentially confusing users.

It doesn't tell you where to look unless we parse all files.

> 2. A module changes the layout of a document
> 
>     In this case, the layout of the document would be unchanged by the
>     module. If you're looking at every document, then this would be
>     obvious; however, if you're using some batch processing system, you
>     could unknowingly send out incorrectly-styled documents quite easily.

Ah ... but texies claim to see the difference so it's an exercise!

> 3. You load a module that provides some command, then never use it
> 
>     This is the only case where the new error would break any documents.
>     However, this case should hopefully be pretty rare since it's
>     pointless to load a module then never use any of its features.

Indeed harmless.

> Making this change could potentially break some documents that currently
> work, but I think that this change is worth it, since I'd rather have
> something break loudly (throwing an error) rather than silently (producing
> a semi-corrupt document).
But ... you can already do

\enabledirectives[logs.errors=*]

or

\enabledirectives[logs.errors=missing modules]

and if needed can add that line to a local cont-loc.mkxl file so that it 
always kicks in.

However, more dangerous is when a user overloads a system macro so if 
you realy want to play safe:

\enabledirectives[overloadmode=error] % or warning

is yuour friend.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2022-08-25  6:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-25  0:19 Max Chernoff via ntg-context
2022-08-25  6:57 ` Hans Hagen via ntg-context [this message]
2022-08-26  1:00   ` Max Chernoff via ntg-context
2022-08-26  5:40     ` Hans Hagen via ntg-context
2022-08-26  6:45       ` Max Chernoff via ntg-context
2022-08-26  7:49     ` Hans Hagen via ntg-context

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=81c7bf84-81b0-d144-27bb-d0527e3b9e22@freedom.nl \
    --to=ntg-context@ntg.nl \
    --cc=j.hagen@freedom.nl \
    --cc=mseven@telus.net \
    /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.
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 NNTP newsgroup(s).