rascal icon indicating copy to clipboard operation
rascal copied to clipboard

public interface for module loading

Open jurgenvinju opened this issue 5 months ago • 0 comments

  • [x] hide the generated public constructors with a @deprecated "for internal use only" tag (because the contract with the $ModuleStore can be violated with manual usage of these constructors)
  • [x] remove unused fields pcfg and rascalSearchPath from the RascalExecutionContext
  • [x] generate a safe static $load method into all classes and interfaces to replace the old usage of constructors (completely and safely hides the moduleStore below the hood).
  • [x] make certain internal methods of RascalExecutionContext @Deprecated "for internal use only"

For example:

  • $ParserGenerator.$load(rex) will return a $ParserGenerator_$I implementation.
  • Also $ParserGenerator_$I.$load(rex) does the same for convenience' sake.
  • repeated calls to $load will return the previously loaded module
  • $load on a previously imported module from the same rex will return the module loaded earlier via the import mechamism: $List.load(rex)
  • A new rex means new object instances which are initialized from scratch.
  • Calling $load for different modules in the same import/extend hierarchy in different orders has no influence on the resulting module references. This is due to how the ModuleStore works. With one exception: the values of globals may be influenced in the presence of side-effects.

jurgenvinju avatar Jun 05 '25 14:06 jurgenvinju