-
Notifications
You must be signed in to change notification settings - Fork 168
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
Allow override core operators #455
Comments
IMHO, Pebble is a Java library and core operators should stick to Java semantics. Why not convert to String or Integer, or compare to correct value or write your own custom extension ? |
Our application contains a live HTML editor which uses pebble behind the scenes to provide templating functionality. we have some monetary amounts which are already localized (hence the string type) and we'd really want to enable our users to do stuff like for us it's not acceptable to expect our users to know which placeholders contain localized amounts (i.e. strings) and which contain actual numbers (i.e. index, counts, etc) I know it's a fairly edgy use case, but having this will really improve our users experience. |
One of core feature if the extensibility of the language. I think it's a good addition to pebble. I'll take a look at the PR later this week. |
As of right now operator overrides are disabled. This means that one cannot change the behaviour of operators like
==
or any others.While the use cases might be very marginal I do have a use case for this: I need to make
==
operator less strict on the types of the arguments. e.g.Problem is that by design everything can be extended or overridden but the unary & binary operators.
My idea is to add a flag to enable the operator overrides. So users can override core operators if they want to. i.e.
where
CustomEqualsExpression.class
would be the override for the==
core operator.The text was updated successfully, but these errors were encountered: