interactive: Add ":l" command to load a module

Bug #439168 reported by Matt Giuca
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mars
Triaged
Wishlist
Matt Giuca

Bug Description

There is currently no way to load a module once Mars interactive mode has started. Add a ":l <modulename>" command, which searches for a module and imports all of its functions and types into the interactive environment.

Make sure it is not vulnerable to bug #408296 (top-level cyclic imports fail).

Tags: feature
Matt Giuca (mgiuca)
Changed in mars:
milestone: none → 0.2.1
Revision history for this message
Matt Giuca (mgiuca) wrote :

Also add :r to reload all modules loaded with :l (as well as the initial module, prelude by default).

Revision history for this message
Matt Giuca (mgiuca) wrote :

I've added the necessarily plumbing in interactive -- a list of all modules already loaded (required for importing, so as to avoid reloading the same module, and also required for reloading, obviously).

However, this is a long way off. We need:
* Reader to take a list of modules already loaded (currently assumes there are none).
* The list to be full (and normalised) paths, not just module names. This is necessary because we'll be loading from the current directory with :l, not necessarily the directory the initial module was loaded from. So we'll forget where we loaded the modules from in the first place. Also, without full paths, we will have clashes if the user loads subdir/foo.mar and then writes ":l foo" (we should allow such a thing).
* To run all the subsequent operations, such as type checking and ast_cfg, after loading the modules.

Using :l will pass the full list to reader, to ensure it doesn't reload an already-loaded module. Using :r will iterate over the list and reload each module, passing the empty set of already-loaded modules and an empty program, to avoid clashes and allow the fresh copy to be loaded.

I'll put this off for now, as it seems like a big effort.

Revision history for this message
Matt Giuca (mgiuca) wrote :

Postponed to Mars 0.3.

Changed in mars:
milestone: 0.2.1 → 0.3
Revision history for this message
Matt Giuca (mgiuca) wrote :

Low priority -- did OK so far without it

Changed in mars:
importance: Medium → Low
Revision history for this message
Matt Giuca (mgiuca) wrote :

This is looking more like something which is just too hard compared to the benefits. Especially since :r will probably have to drop the local variables due to types potentially changing -- there isn't much benefit over Ctrl+Cing and relaunching Mars. Setting this to Wishlist and de-milestoning. May eventually flag as Won't Fix.

Changed in mars:
importance: Low → Wishlist
milestone: 0.3 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.