You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd imagine this would require some support from the DSL, since I'm not specifying T in my rule and in practice impl only implements CustomCompare[int]... There might be multiple possible use cases, although for my purposes I think either of the first two would be fine:
Implements("CustomCompare") meaning the type implements CustomCompare[T] for at least one T. Maybe could also use syntax like "CustomCompare[$_]" or something
Implements("CustomCompare[$t]") meaning the type implements CustomCompare[T] for a specific T based on some other matcher, e.g. maybe some syntax like:
Adding generics support to any of the filters mentioned should be possible, but generics are not really supported as of yet as I didn't need to match anything like that.
Embedding the submatch into filter like that is not possible though.
To do that, we would need a more complicated way of interpreting the strings inside Implements. Almost evaluation-style levels. Instead of making that, I would recommend looking into custom filters direction that allows almost scripting-like abilities (and if it lacks something, it can be added).
Here's a small example of what I'm trying to do. Given this code:
I'd like to write a rule kinda like this:
I'd imagine this would require some support from the DSL, since I'm not specifying
T
in my rule and in practiceimpl
only implementsCustomCompare[int]
... There might be multiple possible use cases, although for my purposes I think either of the first two would be fine:Implements("CustomCompare")
meaning the type implementsCustomCompare[T]
for at least oneT
. Maybe could also use syntax like"CustomCompare[$_]"
or somethingImplements("CustomCompare[$t]")
meaning the type implementsCustomCompare[T]
for a specificT
based on some other matcher, e.g. maybe some syntax like:Implements("CustomCompare[int]")
- implements a concrete interfaceIt might also be useful to have
HasMethod
work in a similar way, although I'm not sure of the technical differences between how those are implemented.Is something like this possible? Or if not currently, is there any workaround I could use for a less-precise way of getting similar functionality?
If not, where in the code would I look if I were to try adding this feature?
Thanks in advance!
go-ruleguard
has been a big help in my organization so I appreciate the work you've done here!The text was updated successfully, but these errors were encountered: