TransWikia.com

Load management for a multi-subcontext application

Mathematica Asked by hlediks on January 18, 2021

I am developing an application containing a large number of functions divided into several independent subcontexts. Let’s say I have a main context Main’ (defining a few general symbols to be used in all subcontexts), and subcontexts Main’A’, Main’B’, and Main’C’ in respective files Main.m, A.m, B.m, and C.m residing in the Kernel subdirectory. I want the application to behave like this when loading:

<<Main`

loads everything, i.e. Main’, Main’A’, Main’B’, and Main’C’ when invoked from a fresh session. Each subsequent call to any subcontext reloads that subcontext only (or nothing if called using Needs). But when a subcontext is loaded from a fresh session, e.g.

<<Main`A`

only main context and Main’A’ are loaded. Subsequent calls to subcontext load/reload called subcontext, but subsequent call

<<Main`

only loads those remaining subcontexts that have not yet been loaded (or none if all were separately loaded).

Is there anybody who can help? Thank you in advance.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP