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

Modules #111

Merged
merged 26 commits into from
Feb 27, 2025
Merged

Modules #111

merged 26 commits into from
Feb 27, 2025

Conversation

tertsdiepraam
Copy link
Contributor

@tertsdiepraam tertsdiepraam commented Feb 12, 2025

Closes #91

To do:

  • Make enum constructors work again
  • Add absolute paths (starting with .)
  • Add imports
  • Fix conflicts
  • Replace todo!s with proper errors and make tests for those errors where necessary.
  • Make modules testable and add tests
  • Document modules so that Luuk can test them (Update docs with Roto modules rotonda-doc#16)

@tertsdiepraam tertsdiepraam marked this pull request as ready for review February 17, 2025 11:17
Copy link

@bal-e bal-e left a comment

Choose a reason for hiding this comment

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

This is a huge change, @tertsdiepraam, well done! Modules are going to make Roto even cooler.

Comment on lines +319 to 323
} else if self.next_is(Token::Period) {
let ident = self.identifier()?;
let span = self.merge_spans(&expr, &ident);
expr =
self.spans.add(span, Expr::Access(Box::new(expr), ident));
Copy link

Choose a reason for hiding this comment

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

Quick question: how do you distinguish the expression foo.bar from meaning "field bar of object foo" or "declaration bar in module foo"? Or does Expr::Access work on modules too?

Copy link
Contributor Author

@tertsdiepraam tertsdiepraam Feb 27, 2025

Choose a reason for hiding this comment

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

Ah yeah that's an interesting detail. So a path can be both, but access is always a field. foo.bar is parsed as a path, but (1 + 1).bar is an access. The former is disambiguated by the typechecker.

@tertsdiepraam tertsdiepraam merged commit 0edcec3 into main Feb 27, 2025
12 checks passed
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.

Modules
3 participants