Skip to content
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

Angular bracket imports for reusable reactor modules #2404

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

vinzbarbuto
Copy link
Collaborator

This PR proposes a new import statement syntax to distinguish between user-defined reactors import and reusable reactors imports. The new syntax for importing reusable reactors will use angular brackets, as shown: import Reactor from <path/to/lib/Reusables.lf>.

Copy link
Member

@lhstrh lhstrh left a comment

Choose a reason for hiding this comment

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

Looks like a good start! I left some questions. The major concern I have is that there are not tests. Please add one.

core/src/main/java/org/lflang/LinguaFranca.xtext Outdated Show resolved Hide resolved
@@ -99,6 +99,7 @@ public Boolean caseModel(Model object) {
public Boolean caseImport(Import object) {
return new ComparisonMachine<>(object, Import.class)
.equalAsObjects(Import::getImportURI)
.equalAsObjects(Import::getImportPackage)
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain how this works?

Copy link
Member

Choose a reason for hiding this comment

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

Does this effectively function like "equal to importURI OR equal to importPackage"?

core/src/main/java/org/lflang/ast/ToLf.java Outdated Show resolved Hide resolved
core/src/main/java/org/lflang/ast/ToSExpr.java Outdated Show resolved Hide resolved
@lhstrh lhstrh added the feature New feature label Sep 9, 2024
@lhstrh lhstrh changed the title Added angular bracket import for reusable reactors module Angular bracket imports for reusable reactor modules Sep 9, 2024
timeout: 2 sec
}

import Count from <lib/Count.lf>
Copy link
Member

Choose a reason for hiding this comment

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

@tanneberger, tagging you because it still appears to be unclear what should be inside the angular brackets. I thought the notation was reserved for packages, not local paths?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the old version. I still need to implement what we discussed last time. My focus here was to fix the formatting errors causing the check to fail. I'm currently working on a new version where we shorten the paths inside the angular brackets to <root/file.lf> for downloaded Lingo packages and lib/file.lf for locally defined libraries

Copy link
Member

Choose a reason for hiding this comment

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

Do you mean "lib/file.lf" for locally defined libraries? My assumption had been that angular brackets are only for published packages, not locally defined ones.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Exactly, use angular brackets for published packages and quotation marks for locally defined libraries. In my previous comment, I was referring to "lib/file.lf", but I mistakenly omitted the quotation marks

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

Successfully merging this pull request may close these issues.

2 participants