Uploaded image for project: 'Commons JEXL'
  1. Commons JEXL
  2. JEXL-367

Named function and fat-arrow (=>) lambda syntax

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.2.1
    • 3.3
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              henrib Henri Biestro
              hussachai Hussachai Puripunpinyo
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: