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

Pattern matching for more robust syntax verification in Python #60

Open
GlowingScrewdriver opened this issue Jun 28, 2024 · 2 comments
Open

Comments

@GlowingScrewdriver
Copy link
Contributor

GlowingScrewdriver commented Jun 28, 2024

The basis for this was laid in #49, which added a function called verify_shape to verify the shapes of lists.
As of now, verify_shapes is capable of recursively checking the lengths and element types of lists, and is used by gen_set_expr to check the syntax of a set expression.

Such a pattern matching framework calls for a discussion before further development.

We can probably take inspiration from Python's own match statement for pattern matching. The only reason it may not be feasible for our use is that we will have to write match-case statements everywhere, which can get messy unlike one-liner function calls.

@GlowingScrewdriver
Copy link
Contributor Author

This should also help with issues like #59.

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

No branches or pull requests

2 participants