The module registration system was designed to work like the image package's decoder registration. Unfortunately, there's a large difference that I didn't take into account: Importing a package that registers a new module changes the behavior of every WDTE script parsed. This means that any kind of import of any package that calls std.Register() can break things. For example, if std/arrays imported std/stream in order to use NextFunc or something, suddenly stream becomes importable from WDTE.
To get around this, the currently globally-exposed std.Import should be replaced with a function, func Import(modules ...string) wdte.Importer, which returns a wdte.Importer that only allows the user to import the modules specified.
On top of this, it probably makes sense to remove std/all. Instead, std can pre-register all of the std/** modules, while those modules then don't have to import std at all. The downside to this is that all of those packages will be included in every Go package, but that's probably fine. The standard library's not particularly huge.
The module registration system was designed to work like the
imagepackage's decoder registration. Unfortunately, there's a large difference that I didn't take into account: Importing a package that registers a new module changes the behavior of every WDTE script parsed. This means that any kind of import of any package that callsstd.Register()can break things. For example, ifstd/arraysimportedstd/streamin order to useNextFuncor something, suddenlystreambecomes importable from WDTE.To get around this, the currently globally-exposed
std.Importshould be replaced with a function,func Import(modules ...string) wdte.Importer, which returns awdte.Importerthat only allows the user to import the modules specified.On top of this, it probably makes sense to remove
std/all. Instead,stdcan pre-register all of thestd/**modules, while those modules then don't have to importstdat all. The downside to this is that all of those packages will be included in every Go package, but that's probably fine. The standard library's not particularly huge.