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 default custom hashing to return None #43

Open
jakehemmerle opened this issue Dec 7, 2023 · 0 comments
Open

Implement default custom hashing to return None #43

jakehemmerle opened this issue Dec 7, 2023 · 0 comments
Labels
code quality refactor; makes things simpler

Comments

@jakehemmerle
Copy link
Contributor

jakehemmerle commented Dec 7, 2023

Note, this first requires a refactor in the .wit file

Currently, every program (and every example) not using custom hashes still needs to implement custom_hash and return None. Ideally, we should be able to implement this with a derive procedural macro.

To do this, we should start with rewriting wit/application.wit to generate multiple worlds or something to change custom-hash implementation from

pub struct XYZProgram;

impl Program for XYZProgram {
   fn evaluate ...{
      ...
   }
   fn custom_hash... {
      ...
   }
}

to

pub struct XYZProgram;

impl Program for XYZProgram {
   fn evaluate ...{
      ...
   }
}

impl CustomHash for XYZProgram {
   fn custom_hash... {
      ...
   }
}

which in turn can be simplified to something like

#[derive(NoCustomHash]
pub struct XYZProgram;

impl Program for XYZ Program {
   fn evaluate ...{
      ...
   }
}
@jakehemmerle jakehemmerle added the code quality refactor; makes things simpler label Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality refactor; makes things simpler
Projects
None yet
Development

No branches or pull requests

1 participant