-
Notifications
You must be signed in to change notification settings - Fork 66
Add native arithmetical expressions support #11
Comments
I don't understand, you want to merge ruler and math grammar to support thinkgs like |
“merge” is not really appropriated. I just would like to see the same features, i.e. native arithmetical expressions. And to reply to your question: yes :-). |
Ok, that would be a good point. But is “Ruler“ a good name ? May be it would be appropriated to make something more global like symfony\ExpressionLanguage ? |
No, as I said, if we need more features, we should focus on Lua which is a real scripting language (more powerful than Symfony\ExpressionLanguage). But are arithmetical operations a need in rules? That's the real question I think. |
@Hywan I think that Ruler should stay a Rete rule algorithm like lib. I'm not very confortable with the fact you can assign a value to any variable in this lib. Should be immutable & read only system I think. |
ok, so I'm fully ok with that 👍 |
Actually, it will not be so much difficult (I think). Arithmetical operators will be introduce in the grammar and treated as |
But what about the BC break it will introduce? |
Why |
Oh, due to conflicts with arythmetic operations If we can't support it, let's go for |
|
This is ambigous indeed, but (7) in SQL is an array with only 7 value :) |
@stephpy Hmm interesting. So, since we postulate the ruler language is close to SQL, do we need to introduce this BC break? Also, |
Imoi, It would be nice to keep SQL syntax, but the question is “Is it possible ?". |
Normally, yes. I have to test, but the only ambiguous syntax is an unary list like |
the difficulty is to supports |
In the same line what will happen when you do |
@flip111 it's not valid, (2,3) is an array, it's like |
@stephpy, you said:
No it should not. |
Is it still relevant ? |
@Hywan just in case of BC break array notation support, the best thing should be indeed to adopt something similar to matlab notation no? So yes |
@Hywan Oops, yes indeed, sorry. |
Looking at the code and grammars, this seems pretty hard to implement. At least, it will require many code duplication:
I think this is not as easy as it seems. |
Yup, it's a very hard problem. |
A trivial merge of
Hoa\Math
in this library to get native arithmetical expressions support.It will introduce a change (so a break) in the grammar. Array declarations will be
[1, 2, 3]
and no longer(1, 2, 3)
. The library has the RC state, so we can still introduce BC breaks. I particulary ask @stephpy, @shouze and @osaris to get their feedbacks :-).Note: we should not add new features in the grammar in the future. If we want more power, we should focus on
Hoathis\Lua
which is a much better scripting language (imperative, procedural, functional etc.).The text was updated successfully, but these errors were encountered: