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

Basic extractors #114

Closed
wants to merge 6 commits into from
Closed

Basic extractors #114

wants to merge 6 commits into from

Conversation

nystrom
Copy link
Collaborator

@nystrom nystrom commented Nov 12, 2024

Simple extractor implementation. Supports only positional arguments for now. This is a strawman to work out the design.

Fixes #92

@nystrom nystrom requested a review from gafter November 12, 2024 17:37
error("$(location.file):$(location.line): The type `$bound_type` has " *
"$(length(field_names)) fields but the pattern expects $len fields.")
end
is_type = !Base.isnothing(try_bind_type(location, T, input, binder))
Copy link
Member

Choose a reason for hiding this comment

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

This line does no good if T is not a symbol. Perhaps

is_extractor = T isa Symbol && Base.isnothing(try_bind_type(location, T, input, binder))

src/binding.jl Outdated Show resolved Hide resolved
end

@testset "extractor function missing" begin
# Bar is neither a type nor an extractor function
Copy link
Member

Choose a reason for hiding this comment

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

Please test the location and text of the diagnostic.

Copy link
Member

@gafter gafter left a comment

Choose a reason for hiding this comment

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

Looks nice, with a couple of minor suggestions.

src/binding.jl Outdated Show resolved Hide resolved
@nystrom
Copy link
Collaborator Author

nystrom commented Nov 21, 2024

Closing in favor of #116

@nystrom nystrom closed this Nov 21, 2024
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.

Support ML-style active patterns
2 participants