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

Add query derive attribute for equality-by-pointer #214

Open
fabianschuiki opened this issue Nov 7, 2020 · 0 comments
Open

Add query derive attribute for equality-by-pointer #214

fabianschuiki opened this issue Nov 7, 2020 · 0 comments
Labels
C-enhancement Category: Adding or improving on features. L-vlog Language: Verilog and SystemVerilog.

Comments

@fabianschuiki
Copy link
Owner

fabianschuiki commented Nov 7, 2020

There are a lot of variants of Ref(node): Ref<'a, ast::Expr<'a>> scattered around the queries. This makes them hard to read, and annoying to work with.

Make #[moore_derive::query] recognize a #[ptr_eq] attribute (or similar), which wraps the given argument in a Ref-like structure that performs equality/hashing by pointer address. The long-term goal would be to never see Ref<...> again in the code 😃 .

An alternative would be to require all query arguments to implement a QueryArg trait, which has a corresponding function for deriving lookup keys. This would likely be the most transparent implementation.

@fabianschuiki fabianschuiki added L-vlog Language: Verilog and SystemVerilog. C-enhancement Category: Adding or improving on features. labels Nov 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Adding or improving on features. L-vlog Language: Verilog and SystemVerilog.
Projects
None yet
Development

No branches or pull requests

1 participant