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

Disabling specific parts of an interface #45

Closed
MilesCranmer opened this issue Jun 22, 2024 · 3 comments
Closed

Disabling specific parts of an interface #45

MilesCranmer opened this issue Jun 22, 2024 · 3 comments

Comments

@MilesCranmer
Copy link
Contributor

Hi @rafaqz,

Nice package! I'm working on adding it to DynamicExpressions.jl to test a few different abstract types: https://github.com/SymbolicML/DynamicExpressions.jl/blob/6c6485a32a63436cee23e0ff837d8653cd6ec223/src/Interfaces.jl#L89.

One question I had is if there is any way to turn off specific parts of an interface? For example, there is a function simplify_tree!. This is technically part of the interface, but there are specific types which break when using it. For those, I want the simplify_tree! call to return a helpful error instead of simply a MethodError – so the user is aware specifically why they shouldn't be trying to simplify that expression.

However I'm not sure the right way to do this. Any tips?

Thanks!
Miles

@MilesCranmer
Copy link
Contributor Author

Ah, sorry, didn't realise I actually needed to pass all the optional methods as type parameters. So I can just not pass certain tests!

@rafaqz
Copy link
Owner

rafaqz commented Jun 22, 2024

Yeah, when you use the @implements macro you can specify the options you have implemented.

That's then reflected in the available implements traits and in what will be tested in test

@MilesCranmer
Copy link
Contributor Author

Oh, that's cool. Thanks!

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