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

Henri Biestro commented on JEXL-399:
------------------------------------

JEXL is not JavaScript and does not try to be as feature-rich. You will have to 
teach chatgpt some of its syntax. Alternatively, have you tried using/embedding 
an actual JavaScript interpreter ? (https://github.com/openjdk/nashorn-)

That being said:
6. Fat-arrow for lambda is configurable through JexlFeatures.
1. and 2. could be added as strictEqual/notStrictEqual operators.
3. exponentiation is accessible through Math.pow in Java (true for Javascript 
too).
4. destructuring assignment is a very rich feature and complex endeavor.
5. map literals using identifiers as keys without interpretation could be 
achieved through options.
7. and 8. can be expressed as for(let k : m.keySet()) and for(let v : 
m.valueSet()) when m is a map.

So 6. is here, 1.2 are easy and may be part of next minor version.

The following are unlikely to be implemented in the short term:
5. is a tad more involved in its simplest form (maps) for little gain.
3., 7., 8. are of a low value for JEXL users.
4. is a lot of work for a condensed syntax.


 

> Needs support more javascript syntax
> ------------------------------------
>
>                 Key: JEXL-399
>                 URL: https://issues.apache.org/jira/browse/JEXL-399
>             Project: Commons JEXL
>          Issue Type: New Feature
>            Reporter: Xu Pengcheng
>            Priority: Major
>
> Hi, I am trying ask chatgpt to generate code for some cases, JEXL, as a 
> lightweight, secure, easy to communicate with host solution, I think is the 
> best option for java world as a bridge between chatgpt and app.
> Unfortunately, chatgpt seems is not familiar with Jexl syntax, so I tried to 
> ask chatgpt to write as javascript, I had implements most of the javascript 
> build-in objects (like Array, Object, Math, console, etc) for JEXL, 95% cases 
> generated by chatgpt can run successfully.
> However, some syntax error will cause the 5% failure, for example:
>  # a === b
>  # a !== b
>  # a = b ** 2
>  # const \{a, b} = x;
>  # a = \{x: 1, y: 2,}
>  # func = () => (\{"a":1, "b": 2})
>  # for (let k in map)
>  # for (let value of map)
> These syntax looks very reasonable, It will be great to support these 
> javascript syntax to let both chatgpt and developer easy to use.
> Thanks!
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to