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

Implement Hash for Expression #123

Open
TitanNano opened this issue Jan 20, 2019 · 2 comments
Open

Implement Hash for Expression #123

TitanNano opened this issue Jan 20, 2019 · 2 comments

Comments

@TitanNano
Copy link

I'm trying to store data associated with an expression. Unfortunately Expression doesn't implement Hash which makes it impossible for me to store the data inside a HashMap. Would it be possible to derive or implement Hash for Expression so an expression can be used as a HashMap key?

@Yoric
Copy link

Yoric commented Jan 20, 2019

Associating arbitrary data to arbitrary nodes is indeed something commonly useful. It's useful to store comments, lines of code, transformation data, etc.

One solution would be to have all nodes carry on a unique integer or a Rc::Weak<Any>. Or to parameterize all nodes by a payload type T.

@TitanNano
Copy link
Author

Is this something that could be done in the near future? I'd be happy to, but I don't know how. So if someone could give me some pointers into the right direction, then I'd be happy to work on it.

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