Skip to content

refactor: change sequence statement to more functional approach#3

Merged
marcelomamorim merged 2 commits intomainfrom
feature/improve-sequence-statement
Nov 2, 2024
Merged

refactor: change sequence statement to more functional approach#3
marcelomamorim merged 2 commits intomainfrom
feature/improve-sequence-statement

Conversation

@marcelomamorim
Copy link
Copy Markdown
Collaborator

Pull Request: Functional Refactoring and Enhanced Testing

Summary

This pull request refines the Sequence statement execution logic with a more functional approach and introduces additional tests to strengthen the interpreter's evaluation and execution functions.

Changes Made

  1. Refactored Sequence Execution Logic:

    • Simplified the Sequence statement execution by leveraging and_then, improving readability and making error handling more concise.
    • New Sequence logic:
      Statement::Sequence(s1, s2) => {
          execute(s1, env).and_then(|new_env| execute(s2, new_env))
      }
  2. Added Tests for Core Functionality:

    • Expanded test coverage to include more complex scenarios, such as nested expressions, conditionals, and loops.
    • New tests confirm variable assignments, loop operations, and conditional branching functionality, ensuring the interpreter’s robustness.

Additional Notes

  • The refactor moves the code toward a more functional style by chaining operations and reducing nested structures.
  • This update maintains all previously defined behaviors with no breaking changes.

@helpmehelpus
Copy link
Copy Markdown
Collaborator

Looks good! Just give cargo fmt a run. We can - and probably should - automate this eventually

@marcelomamorim
Copy link
Copy Markdown
Collaborator Author

Looks good! Just give cargo fmt a run. We can - and probably should - automate this eventually

Done :)

@marcelomamorim marcelomamorim merged commit 9dbf366 into main Nov 2, 2024
EmersonJr pushed a commit to EmersonJr/r-python that referenced this pull request Feb 12, 2025
RafaelLopes23 pushed a commit that referenced this pull request Dec 11, 2025
Adjust <open> to new metaStmt structure
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