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
Could json logic operators be protected interal? #368
Comments
It's more a philisophical reason. The primary mechanism for creating custom behavior is through defining custom rules. If you register an operation that already exists, it'll overwrite with your rule. However, I can see an argument for wanting to actually override the rule class in order to take advantage of the default behavior except for certain cases. I was going to suggest a composition approach for now, but that requires that you be able to access the Yeah, I think |
I agree that composition approach would be preferable, though that would require making the classes and their constructors public. |
Created a PR for the internal protected approach. Cheers, |
Thanks for the PR. I'll have a look over it today.
My philosophical objection wasn't so much one of "composition over inheritance" as these operations are well-defined. Making an operation do something else isn't interoperable. However, you do provide a good use case, and so long as you understand the interoperability implications of your change, I shouldn't prevent you from making it. |
Ah, I see whay you mean. Yes, I agree. I've added to the docs to explain those implications. |
Hi,
I was wondering if there was a technical reason for marking the Json Logic operators as internal?
We are trying to extend the library a little for internal use, and would like to override the behaviour of several comparison operators in certain circumstances, so that if the data being operated on meets a certain condition, ie, it looks like a Date, then we perform our own comparison, otherwise, we defer to the code that already exists in say <, >, =>, =< for example.
Currently, we can't inherit from or instansiate these operators, without maybe resorting to reflection.
Would you be open to the idea of changing the access modifiers on operators, and thier fields to protected internal?
I can raise a PR for this work if it's something that works for you.
If this is not desirable for you, can you suggest an alternative?
For reference, here is a sample of what we are trying to achieve;
Thanks,
Dave
The text was updated successfully, but these errors were encountered: