You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Hussachai Puripunpinyo (Jira)" <ji...@apache.org> on 2022/05/01 04:20:00 UTC

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

    [ 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)