Skip to content

Why are some OpTags not available as NodeHandle? #427

Closed Answered by aborgna-q
lmondada asked this question in Q&A
Discussion options

You must be logged in to vote

Ideally we'd use OpTags as root node restrictions, but notice that tags are enum values while NodeHandles are types implementing a trait.

We cannot parametrize types with values, so we're restricted to using handle types with associated tags instead.
(Rust supports const generics like Array<const N: usize>, but it doesn't allow arbitrary enums like OpTag).

We could define more generic handles for each available tag, and NodeHandle::try_cast where necessary. I just worry that the explicit calls may get annoying.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ss2165
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants