Skip to content

public interface for module loading #2287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

jurgenvinju
Copy link
Member

@jurgenvinju jurgenvinju commented Jun 5, 2025

  • 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)
  • remove unused fields pcfg and rascalSearchPath from the RascalExecutionContext
  • 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).
  • 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 jurgenvinju requested a review from PaulKlint June 5, 2025 14:10
@jurgenvinju jurgenvinju self-assigned this Jun 24, 2025
@jurgenvinju
Copy link
Member Author

@PaulKlint wasn't this one merged already?

Copy link
Member

@PaulKlint PaulKlint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jurgenvinju: no it was not yet merged for statbility reasons. Will do asap.

@PaulKlint PaulKlint merged commit 1a20bca into compiled-parser-generator Jul 1, 2025
Copy link
Member

@PaulKlint PaulKlint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jurgenvinju: you probably did not test this, does not work. Fixing it now.

@PaulKlint
Copy link
Member

I have reverted the merge of this code since it does not seem to work. More testing needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants