[jira] [Commented] (JEXL-367) Deprecate -> and support =>

2022-05-03 Thread Hussachai Puripunpinyo (Jira)


[ 
https://issues.apache.org/jira/browse/JEXL-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17531494#comment-17531494
 ] 

Hussachai Puripunpinyo commented on JEXL-367:
-

[~henrib]  We added a ton of things to JEXL. We also removed a lot of things 
from JEXL.
For example, this one will work on our JEXL fork as well as JS
{code:java}
var list = [1, 2, 3];
var r = list.map(x => {return x * x}).reduce((acc, x) => { return acc + x});
console.log(r) {code}
We have data binding for Scala and Kotlin. When the list literal above is used 
in Scala environment, it produces scala.immutable.List instead of 
java.util.List. The map, reduce, and other functions defined in JS work out of 
the box.
We also unwrap Java Optional, Scala Option, Kotlin Arrow Option and other 
monadic types like Either and Try by default.
The dot notation (object navigation) is null-safe by default. So, for the 
expression like a.b.c 
if a is null, it's still fine. If b is Option, it will be unwrapped. There is 
no other language can beat this succinctness :) 
We also have some weird features that some objects can behave differently based 
on the context it is used. Some objects can yield a dynamically computed value 
instead of the object itself.
My users understand that this is not JS and they actually like it more than JS. 
Like the above example. The return keyword can be omitted in JEXL but it's 
required in JS. The JSON navigation works out of the box and it doesn't matter 
what JSON library they are using, our JEXL fork understands their JSON tree and 
walks it as if it is a regular object.
Unfortunately, the code is hosted in my company private repo and I'm kinda 
believe that it's hard to request it to be open source
due to security concerns. 



 

[~dmitri_blinov] You have a valid point, but I don't think it is good for JEXL 
to be a unique language by its own. Honestly, JEXL as a language doesn't stand 
a chance to compete with other languages out there. To be unique and making it 
worth learning must come with substantial benefits that users will gain. The 
key point is familiarity as most of my users do not want to be a JEXL expert. 
My target users are not even a software engineer. They want to get the job done 
with minimum effort. They usually don't care much about the beauty of code or 
how smart the language is. They just want to utilize their existing knowledge.



I like that JEXL is similar to JS and it has some unique features that make it 
even better for quick and dirty scripting (JEXL is much better than Coffescript 
for example). My JEXL fork is also much more succinct than JS and it works well 
across different JVM languages. Thanks to the extensibility of JEXL.  
Before JEXL, we did use Nashorn as our javascript engine. It's not quite 
secure, and the performance is really poor. On top of that, Nashorn has its own 
types that we have to convert back and forth (We cannot create a native binding 
so there is a big overhead right there). We cannot reuse existing 
Java/Kotlin/Scala libraries there. Putting JS libraries and interpreting the 
whole thing takes enormous time and resource. So, we didn't even dare to think 
about doing it :D  Later, Oracle announced that they would deprecate Nashorn in 
Java11, and it was the last string for us. We were uncertain with the future of 
the engine. So we dropped it and looked for another simple language to use. 
Luckily I found the hidden gem, JEXL. So, we extended it instead of building 
everything from scratch. Since Rhino is mentioned, I can tell you that Nashorn 
is slow but it's still way faster than Rhino. Using JS engine in JVM, it means 
we also have to deal with the platform compatibility and the code base that is 
way harder to comprehend than JEXL because the full JS implementation is very 
very complex. 

> Deprecate -> and support =>
> ---
>
> Key: JEXL-367
> URL: https://issues.apache.org/jira/browse/JEXL-367
> Project: Commons JEXL
>  Issue Type: Wish
>Affects Versions: 3.2.1
>Reporter: Hussachai Puripunpinyo
>Assignee: Henri Biestro
>Priority: Major
>
> The JEXL code surprisingly looks a lot like Javascript. I think this change 
> is a good transition for folks to update the code, and it's pretty fine if 
> they can tolerate using the deprecate syntax and don't mind seeing a warning 
> log pop up every time. 
> I'd like to propose supporting => and deprecate ->.
> The reasons are
>  - JavaScript becomes very popular and many people are familiar with it.
>  - JEXL is more like for a quick short script. In many scenarios, the target 
> audiences are not a programer. They often mistake a language as a JavaScript 
> (from my experience).
>  - JEXL syntax already looks a lot like JavaScript
>  -- var for variable declaration (Java added in Java 10, but JavaSc

[jira] [Commented] (JEXL-367) Deprecate -> and support =>

2022-05-03 Thread Dmitri Blinov (Jira)


[ 
https://issues.apache.org/jira/browse/JEXL-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17531394#comment-17531394
 ] 

Dmitri Blinov commented on JEXL-367:


[~hussachai] thanks for the thorough observation, but my question was rather 
about why trying to make JEXL yet another JS, groovy or you name it. One 
probably won’t get close to the original, and what is the point of being half 
alike? There are open projects like aforementioned rhino, that one can freely 
use now-days and enjoy bells and whistles. But IMO, in JEXL world you will 
hardly make variables work like JS ones, regarding redefinition, hoisting and 
capturing behavior, without overcomplicating the long existing concept of 
context and local variables with toggles and features.

[~henrib] I think JS have coined some cool features, that JEXL can surely 
benefit from, but IMO its variable model is not one of them, are you sure you 
want let it ‘let’ ?:)

> Deprecate -> and support =>
> ---
>
> Key: JEXL-367
> URL: https://issues.apache.org/jira/browse/JEXL-367
> Project: Commons JEXL
>  Issue Type: Wish
>Affects Versions: 3.2.1
>Reporter: Hussachai Puripunpinyo
>Assignee: Henri Biestro
>Priority: Major
>
> The JEXL code surprisingly looks a lot like Javascript. I think this change 
> is a good transition for folks to update the code, and it's pretty fine if 
> they can tolerate using the deprecate syntax and don't mind seeing a warning 
> log pop up every time. 
> I'd like to propose supporting => and deprecate ->.
> The reasons are
>  - JavaScript becomes very popular and many people are familiar with it.
>  - JEXL is more like for a quick short script. In many scenarios, the target 
> audiences are not a programer. They often mistake a language as a JavaScript 
> (from my experience).
>  - JEXL syntax already looks a lot like JavaScript
>  -- var for variable declaration (Java added in Java 10, but JavaScript 
> supports this from the beginning)
>  -- The function keyword
>  -- Implicit type coercion
>  -- Ternary operator
> The proposed change.
>  * Support => in addition to ->
>  * Deprecate -> and show a warning log when it's used.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (JEXL-367) Deprecate -> and support =>

2022-05-03 Thread Henri Biestro (Jira)


[ 
https://issues.apache.org/jira/browse/JEXL-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17531120#comment-17531120
 ] 

Henri Biestro commented on JEXL-367:


I'm sorry if my previous statement came out too strong; we are probably all in 
agreement.

Again, as much as can be, I'll try and keep an opened mind when syntactic 
choices are made to be close (or identical) to JS. I don't hold any grudges 
against JS - besides the fact that it is a much too powerful language for 
scripting :) (imho: prototypes, this, classes are above scripting complexity 
necessities).

[~hussachai] What are your other added features in your fork? (does not seem to 
be on GitHub, is it?).

About JS, just realised that [Rhino|https://github.com/mozilla/rhino] is still 
alive ! ;)

 

> Deprecate -> and support =>
> ---
>
> Key: JEXL-367
> URL: https://issues.apache.org/jira/browse/JEXL-367
> Project: Commons JEXL
>  Issue Type: Wish
>Affects Versions: 3.2.1
>Reporter: Hussachai Puripunpinyo
>Assignee: Henri Biestro
>Priority: Major
>
> The JEXL code surprisingly looks a lot like Javascript. I think this change 
> is a good transition for folks to update the code, and it's pretty fine if 
> they can tolerate using the deprecate syntax and don't mind seeing a warning 
> log pop up every time. 
> I'd like to propose supporting => and deprecate ->.
> The reasons are
>  - JavaScript becomes very popular and many people are familiar with it.
>  - JEXL is more like for a quick short script. In many scenarios, the target 
> audiences are not a programer. They often mistake a language as a JavaScript 
> (from my experience).
>  - JEXL syntax already looks a lot like JavaScript
>  -- var for variable declaration (Java added in Java 10, but JavaScript 
> supports this from the beginning)
>  -- The function keyword
>  -- Implicit type coercion
>  -- Ternary operator
> The proposed change.
>  * Support => in addition to ->
>  * Deprecate -> and show a warning log when it's used.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (JEXL-367) Deprecate -> and support =>

2022-05-02 Thread Hussachai Puripunpinyo (Jira)


[ 
https://issues.apache.org/jira/browse/JEXL-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17531040#comment-17531040
 ] 

Hussachai Puripunpinyo commented on JEXL-367:
-

I know you are not asking me but since I like JEXL approach for the most part. 
So I'd like to voice my opinion a little bit here.
Java is a statically typed language. JEXL is not built for a big sophisticate 
code. It's for a quick and probably dirty script that can get the job done. 
Statically type for this kind of job is overkill. Also, it's quite complex to 
built a statically typed language.

Groovy has a very small user base. Many people don't even know that this 
language exists. The only thing that keeps it alive is gradle. I'm sure Kotlin 
will take over that space soon. and Grails is .. what is that?

Python is not JVM. (I know there was Jython/JPython and it's long gone). Python 
is a dynamically typed language and it's very good for scripting too. 
Everything looks good exception indentations that can throw many people off. 
Also, It'll be very hard to embed python code in Java when multiline string is 
not supported (I know it's now possible with Java 15).

I don't think there is anything so special about JS. It's just popular and a 
lot of people know it. I believe my PM can write a basic JS code. The 
documentation/books/tutorial are everywhere. Anyone can try it out quickly 
without installing anything. 
It's just about familiarity. I advertise my JEXL fork as a subset of JavaScript 
on steroid. We support a lot of JS functions and most of the time, JEXL code 
written by our users can be run in the web browser too. If JEXL is not resemble 
to JS, I'd have a question too. Why not JS?

> Deprecate -> and support =>
> ---
>
> Key: JEXL-367
> URL: https://issues.apache.org/jira/browse/JEXL-367
> Project: Commons JEXL
>  Issue Type: Wish
>Affects Versions: 3.2.1
>Reporter: Hussachai Puripunpinyo
>Assignee: Henri Biestro
>Priority: Major
>
> The JEXL code surprisingly looks a lot like Javascript. I think this change 
> is a good transition for folks to update the code, and it's pretty fine if 
> they can tolerate using the deprecate syntax and don't mind seeing a warning 
> log pop up every time. 
> I'd like to propose supporting => and deprecate ->.
> The reasons are
>  - JavaScript becomes very popular and many people are familiar with it.
>  - JEXL is more like for a quick short script. In many scenarios, the target 
> audiences are not a programer. They often mistake a language as a JavaScript 
> (from my experience).
>  - JEXL syntax already looks a lot like JavaScript
>  -- var for variable declaration (Java added in Java 10, but JavaScript 
> supports this from the beginning)
>  -- The function keyword
>  -- Implicit type coercion
>  -- Ternary operator
> The proposed change.
>  * Support => in addition to ->
>  * Deprecate -> and show a warning log when it's used.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (JEXL-367) Deprecate -> and support =>

2022-05-02 Thread Dmitri Blinov (Jira)


[ 
https://issues.apache.org/jira/browse/JEXL-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17530901#comment-17530901
 ] 

Dmitri Blinov commented on JEXL-367:


[~henrib] May I ask what is so special about JS, why not java, groovy or may be 
python ?:) 

> Deprecate -> and support =>
> ---
>
> Key: JEXL-367
> URL: https://issues.apache.org/jira/browse/JEXL-367
> Project: Commons JEXL
>  Issue Type: Wish
>Affects Versions: 3.2.1
>Reporter: Hussachai Puripunpinyo
>Assignee: Henri Biestro
>Priority: Major
>
> The JEXL code surprisingly looks a lot like Javascript. I think this change 
> is a good transition for folks to update the code, and it's pretty fine if 
> they can tolerate using the deprecate syntax and don't mind seeing a warning 
> log pop up every time. 
> I'd like to propose supporting => and deprecate ->.
> The reasons are
>  - JavaScript becomes very popular and many people are familiar with it.
>  - JEXL is more like for a quick short script. In many scenarios, the target 
> audiences are not a programer. They often mistake a language as a JavaScript 
> (from my experience).
>  - JEXL syntax already looks a lot like JavaScript
>  -- var for variable declaration (Java added in Java 10, but JavaScript 
> supports this from the beginning)
>  -- The function keyword
>  -- Implicit type coercion
>  -- Ternary operator
> The proposed change.
>  * Support => in addition to ->
>  * Deprecate -> and show a warning log when it's used.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (JEXL-367) Deprecate -> and support =>

2022-05-02 Thread Henri Biestro (Jira)


[ 
https://issues.apache.org/jira/browse/JEXL-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17530714#comment-17530714
 ] 

Henri Biestro commented on JEXL-367:


Thanks [~dmitri_blinov] for the explanation.

Back to the matter at hand; JEXL's goal is *not* to become an implementation of 
JavaScript. We will try and reduce some syntactic differences between JEXL and 
JavaScript when possible.

The 'function name() {..}' syntax could probably be valid shortcut for 'var 
name = function() {...}'. 

> Deprecate -> and support =>
> ---
>
> Key: JEXL-367
> URL: https://issues.apache.org/jira/browse/JEXL-367
> Project: Commons JEXL
>  Issue Type: Wish
>Affects Versions: 3.2.1
>Reporter: Hussachai Puripunpinyo
>Assignee: Henri Biestro
>Priority: Major
>
> The JEXL code surprisingly looks a lot like Javascript. I think this change 
> is a good transition for folks to update the code, and it's pretty fine if 
> they can tolerate using the deprecate syntax and don't mind seeing a warning 
> log pop up every time. 
> I'd like to propose supporting => and deprecate ->.
> The reasons are
>  - JavaScript becomes very popular and many people are familiar with it.
>  - JEXL is more like for a quick short script. In many scenarios, the target 
> audiences are not a programer. They often mistake a language as a JavaScript 
> (from my experience).
>  - JEXL syntax already looks a lot like JavaScript
>  -- var for variable declaration (Java added in Java 10, but JavaScript 
> supports this from the beginning)
>  -- The function keyword
>  -- Implicit type coercion
>  -- Ternary operator
> The proposed change.
>  * Support => in addition to ->
>  * Deprecate -> and show a warning log when it's used.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (JEXL-367) Deprecate -> and support =>

2022-05-01 Thread Dmitri Blinov (Jira)


[ 
https://issues.apache.org/jira/browse/JEXL-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17530490#comment-17530490
 ] 

Dmitri Blinov commented on JEXL-367:


[~henrib] In short, in JS world fat arrow functions have their own ‘this’ 
scope, and don’t have bindings to ‘arguments’. There are also restrictions to 
use some operators etc. I think it’s pretty much documented in JS reference[JS 
reference|[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions]|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions].]

The point is - arrow functions are not syntactic sugar for usual functions in 
JS. In JEXL world the differences above may not apply, since, for example, 
there is no ‘this’, yet. 

But as a thought - if we seriously decided to chase JS, IMO there are plenty of 
other missing features - operators, statements, constructor calls, varargs. For 
all it worth, I have had even added them in my fork the other day, so if anyone 
is interested please have a look.

> Deprecate -> and support =>
> ---
>
> Key: JEXL-367
> URL: https://issues.apache.org/jira/browse/JEXL-367
> Project: Commons JEXL
>  Issue Type: Wish
>Affects Versions: 3.2.1
>Reporter: Hussachai Puripunpinyo
>Assignee: Henri Biestro
>Priority: Major
>
> The JEXL code surprisingly looks a lot like Javascript. I think this change 
> is a good transition for folks to update the code, and it's pretty fine if 
> they can tolerate using the deprecate syntax and don't mind seeing a warning 
> log pop up every time. 
> I'd like to propose supporting => and deprecate ->.
> The reasons are
>  - JavaScript becomes very popular and many people are familiar with it.
>  - JEXL is more like for a quick short script. In many scenarios, the target 
> audiences are not a programer. They often mistake a language as a JavaScript 
> (from my experience).
>  - JEXL syntax already looks a lot like JavaScript
>  -- var for variable declaration (Java added in Java 10, but JavaScript 
> supports this from the beginning)
>  -- The function keyword
>  -- Implicit type coercion
>  -- Ternary operator
> The proposed change.
>  * Support => in addition to ->
>  * Deprecate -> and show a warning log when it's used.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (JEXL-367) Deprecate -> and support =>

2022-04-30 Thread Hussachai Puripunpinyo (Jira)


[ 
https://issues.apache.org/jira/browse/JEXL-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17530481#comment-17530481
 ] 

Hussachai Puripunpinyo commented on JEXL-367:
-

[~henrib]  Fair enough. I've been thinking about this, and I think I agree with 
you on the feature control. I don't like two syntax doing the same thing like 
supporting both fat arrow and thin arrow at the same time. Even one is 
deprecated, users tend to ignore that and I feel like the code will be 
confusing. So, the feature control is a good idea.

That's a great news to me to know that `let` is in your plan. We have a lot of 
JEXL scripts written by users and some script are really huge. One thing about 
`var`. If it's declared at the top level, it still won't be exported to the 
context. Is that intentional? 

Also, I know this is deviating from the original topic, but since I got your 
attention here. 
Do you plan to support the function declaration syntax like the following? 
{code:java}
function name(args) {
  ...
}
{code}

> Deprecate -> and support =>
> ---
>
> Key: JEXL-367
> URL: https://issues.apache.org/jira/browse/JEXL-367
> Project: Commons JEXL
>  Issue Type: Wish
>Affects Versions: 3.2.1
>Reporter: Hussachai Puripunpinyo
>Assignee: Henri Biestro
>Priority: Major
>
> The JEXL code surprisingly looks a lot like Javascript. I think this change 
> is a good transition for folks to update the code, and it's pretty fine if 
> they can tolerate using the deprecate syntax and don't mind seeing a warning 
> log pop up every time. 
> I'd like to propose supporting => and deprecate ->.
> The reasons are
>  - JavaScript becomes very popular and many people are familiar with it.
>  - JEXL is more like for a quick short script. In many scenarios, the target 
> audiences are not a programer. They often mistake a language as a JavaScript 
> (from my experience).
>  - JEXL syntax already looks a lot like JavaScript
>  -- var for variable declaration (Java added in Java 10, but JavaScript 
> supports this from the beginning)
>  -- The function keyword
>  -- Implicit type coercion
>  -- Ternary operator
> The proposed change.
>  * Support => in addition to ->
>  * Deprecate -> and show a warning log when it's used.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (JEXL-367) Deprecate -> and support =>

2022-04-30 Thread Henri Biestro (Jira)


[ 
https://issues.apache.org/jira/browse/JEXL-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17530431#comment-17530431
 ] 

Henri Biestro commented on JEXL-367:


The 'thin arrow' syntax will not be deprecated, the 'fat arrow' syntax will be 
added; a JexlFeature will allow choosing the syntax you want to support. Some 
of us still see Java as the base for JEXL ;) .
As a side note, I'll probably introduce 'let' as a lexical block scope variable 
declaration; only equivalent to 'var' when the JexlFeatures are set that way. 
This will allow a finer grain migration towards lexical scope rules (for users 
with numerous gigantic scripts...).
[~dmitri_blinov] What are the differences between 'fat arrow' and function 
(besides syntactic sugar); care to illustrate ?

> Deprecate -> and support =>
> ---
>
> Key: JEXL-367
> URL: https://issues.apache.org/jira/browse/JEXL-367
> Project: Commons JEXL
>  Issue Type: Wish
>Affects Versions: 3.2.1
>Reporter: Hussachai Puripunpinyo
>Assignee: Henri Biestro
>Priority: Major
>
> The JEXL code surprisingly looks a lot like Javascript. I think this change 
> is a good transition for folks to update the code, and it's pretty fine if 
> they can tolerate using the deprecate syntax and don't mind seeing a warning 
> log pop up every time. 
> I'd like to propose supporting => and deprecate ->.
> The reasons are
>  - JavaScript becomes very popular and many people are familiar with it.
>  - JEXL is more like for a quick short script. In many scenarios, the target 
> audiences are not a programer. They often mistake a language as a JavaScript 
> (from my experience).
>  - JEXL syntax already looks a lot like JavaScript
>  -- var for variable declaration (Java added in Java 10, but JavaScript 
> supports this from the beginning)
>  -- The function keyword
>  -- Implicit type coercion
>  -- Ternary operator
> The proposed change.
>  * Support => in addition to ->
>  * Deprecate -> and show a warning log when it's used.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (JEXL-367) Deprecate -> and support =>

2022-04-30 Thread Dmitri Blinov (Jira)


[ 
https://issues.apache.org/jira/browse/JEXL-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17530387#comment-17530387
 ] 

Dmitri Blinov commented on JEXL-367:


Fat arrows have special meaning in JS and are not stict equivalents to 
traditional functions. IMO It would be strange to deprecate existing 
functionality in favor of new one just for the sake of questionnable similarity 
to JS in one aspect. What's will be next? renaming `var` to `let`?

> Deprecate -> and support =>
> ---
>
> Key: JEXL-367
> URL: https://issues.apache.org/jira/browse/JEXL-367
> Project: Commons JEXL
>  Issue Type: Wish
>Affects Versions: 3.2.1
>Reporter: Hussachai Puripunpinyo
>Assignee: Henri Biestro
>Priority: Major
>
> The JEXL code surprisingly looks a lot like Javascript. I think this change 
> is a good transition for folks to update the code, and it's pretty fine if 
> they can tolerate using the deprecate syntax and don't mind seeing a warning 
> log pop up every time. 
> I'd like to propose supporting => and deprecate ->.
> The reasons are
>  - JavaScript becomes very popular and many people are familiar with it.
>  - JEXL is more like for a quick short script. In many scenarios, the target 
> audiences are not a programer. They often mistake a language as a JavaScript 
> (from my experience).
>  - JEXL syntax already looks a lot like JavaScript
>  -- var for variable declaration (Java added in Java 10, but JavaScript 
> supports this from the beginning)
>  -- The function keyword
>  -- Implicit type coercion
>  -- Ternary operator
> The proposed change.
>  * Support => in addition to ->
>  * Deprecate -> and show a warning log when it's used.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (JEXL-367) Deprecate -> and support =>

2022-04-28 Thread Hussachai Puripunpinyo (Jira)


[ 
https://issues.apache.org/jira/browse/JEXL-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17529792#comment-17529792
 ] 

Hussachai Puripunpinyo commented on JEXL-367:
-

I raised this Jira because I think many people kinda prefer the fat arrow to 
the arrow. I think I have seen a PR for this change, but I understand that you 
want to maintain the backward compat. 

The feature controller will work. IMO, I'd prefer to have this 
not-configurable. It'll be less error prone that way. It's also hard to move 
the existing JEXL code base to the new one if we only support one syntax at a 
time. We probably need to have 2 engines, one for the old code and another one 
for the new code. We need to read AST just to determine what engine should be 
used, and it doesn't sound good for this complication. That's why I'd like to 
propose supporting both syntax at the same time and deprecate the old syntax. 
Maybe JEXL 4 or 5 can drop the support. or it can be like Thread.stop in Java 
where it will be deprecated forever :D 

> Deprecate -> and support =>
> ---
>
> Key: JEXL-367
> URL: https://issues.apache.org/jira/browse/JEXL-367
> Project: Commons JEXL
>  Issue Type: Wish
>Affects Versions: 3.2.1
>Reporter: Hussachai Puripunpinyo
>Assignee: Henri Biestro
>Priority: Major
>
> The JEXL code surprisingly looks a lot like Javascript. I think this change 
> is a good transition for folks to update the code, and it's pretty fine if 
> they can tolerate using the deprecate syntax and don't mind seeing a warning 
> log pop up every time. 
> I'd like to propose supporting => and deprecate ->.
> The reasons are
>  - JavaScript becomes very popular and many people are familiar with it.
>  - JEXL is more like for a quick short script. In many scenarios, the target 
> audiences are not a programer. They often mistake a language as a JavaScript 
> (from my experience).
>  - JEXL syntax already looks a lot like JavaScript
>  -- var for variable declaration (Java added in Java 10, but JavaScript 
> supports this from the beginning)
>  -- The function keyword
>  -- Implicit type coercion
>  -- Ternary operator
> The proposed change.
>  * Support => in addition to ->
>  * Deprecate -> and show a warning log when it's used.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (JEXL-367) Deprecate -> and support =>

2022-04-28 Thread Henri Biestro (Jira)


[ 
https://issues.apache.org/jira/browse/JEXL-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17529610#comment-17529610
 ] 

Henri Biestro commented on JEXL-367:


As a mitigation, we could certainly accommodate the 'fat-arrow' vs 'arrow' as a 
feature; the parser can accommodate both syntaxes easily and the feature 
controller accommodate the check.

> Deprecate -> and support =>
> ---
>
> Key: JEXL-367
> URL: https://issues.apache.org/jira/browse/JEXL-367
> Project: Commons JEXL
>  Issue Type: Wish
>Reporter: Hussachai Puripunpinyo
>Priority: Major
>
> The JEXL code surprisingly looks a lot like Javascript. I think this change 
> is a good transition for folks to update the code, and it's pretty fine if 
> they can tolerate using the deprecate syntax and don't mind seeing a warning 
> log pop up every time. 
> I'd like to propose supporting => and deprecate ->.
> The reasons are
>  - JavaScript becomes very popular and many people are familiar with it.
>  - JEXL is more like for a quick short script. In many scenarios, the target 
> audiences are not a programer. They often mistake a language as a JavaScript 
> (from my experience).
>  - JEXL syntax already looks a lot like JavaScript
>  -- var for variable declaration (Java added in Java 10, but JavaScript 
> supports this from the beginning)
>  -- The function keyword
>  -- Implicit type coercion
>  -- Ternary operator
> The proposed change.
>  * Support => in addition to ->
>  * Deprecate -> and show a warning log when it's used.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)