From f38c13c12b394afc8eb34efa15ea7784158588d5 Mon Sep 17 00:00:00 2001 From: springcomp Date: Mon, 28 Feb 2022 19:00:26 +0100 Subject: [PATCH 1/3] Third-party functions. --- ...-015-third-party-function-registrations.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 proposals/draft/jep-015-third-party-function-registrations.md diff --git a/proposals/draft/jep-015-third-party-function-registrations.md b/proposals/draft/jep-015-third-party-function-registrations.md new file mode 100644 index 0000000..1558ec1 --- /dev/null +++ b/proposals/draft/jep-015-third-party-function-registrations.md @@ -0,0 +1,62 @@ +# Third-Party Functions + +||| +|---|--- +| **JEP** | 15 +| **Author** | Nolan Wood, Maxime Labelle +| **Status** | draft +| **Created**| 28-Feb-2015 + +## Abstract + +This JEP proposes a new distinction between _reserved function names_ +and _third-party function names. This allows the spec to evolve by +introducing new functions without the fear of clashing with existing +functions from popular third-party implementations. + +## Motivation + +Virtually all the current language implementations of JMESPath support +registering additional "custom" functions that add features to JMESPath. + +There is currently no restrictions as to what those function names may be +except that is must match the `unquoted-string` production. + +This proposal specifically acknowledges that third-party functions may +be used to extend JMESPath and mandates tha all third-party function +names should start with a leading underscore character. + +Functions whose names starts with a letter – known or future – are +effectively reserved exclusively for use by JMESPath. + +## Specification + +This JEP proposes adding the following text to the specification in the +[Function Expressions](https://jmespath-unofficial.github.io/jmespath.site/specification.html#functions) section: + +> ### Function Expressions +> Functions allow users to easily transform and filter data in JMEPath expressions. +> Built-in functions are defined by JMESPath. However, a compliant implementation +> MAY support registration of new functions to extend JMESPath. +> +> Functions whose name starts with an alphabetic character (_i.e_ `A-Za-z`) are reserved +> for JMESPath. +> Conversely, third-party function names SHOULD start with a leading underscore character +> (_i.e_ `_` ). +> +> Registration of conflicting function names MAY raise an error. +> However, if no error is raised, built-in functions MUST take precedence over +> third-party functions. +> The resolution of conflicting function names from competing third-party libraries +> is undefined. + + +## Rationale + +This JEP does not introduce any grammar change. + +Although there has been discussions about having a different semantic constructs +for both _reserved functions_ and _third-party functions_, it has been considered +as an implementation detail. Besides, this would unnecessarily make it more +difficult for library authors to maintain two different logics for evaluating +functions. From 173e7ad7805430611e1ccc0608482d2e8a577e71 Mon Sep 17 00:00:00 2001 From: springcomp Date: Mon, 28 Feb 2022 19:04:03 +0100 Subject: [PATCH 2/3] Fixed proposal date. --- proposals/draft/jep-015-third-party-function-registrations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/draft/jep-015-third-party-function-registrations.md b/proposals/draft/jep-015-third-party-function-registrations.md index 1558ec1..a8ce530 100644 --- a/proposals/draft/jep-015-third-party-function-registrations.md +++ b/proposals/draft/jep-015-third-party-function-registrations.md @@ -5,7 +5,7 @@ | **JEP** | 15 | **Author** | Nolan Wood, Maxime Labelle | **Status** | draft -| **Created**| 28-Feb-2015 +| **Created**| 28-Feb-2022 ## Abstract From 6f9152c2444f4efa8ec55950a21425af6b423a30 Mon Sep 17 00:00:00 2001 From: springcomp Date: Tue, 1 Mar 2022 09:25:38 +0100 Subject: [PATCH 3/3] Fixed typos. --- .../draft/jep-015-third-party-function-registrations.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proposals/draft/jep-015-third-party-function-registrations.md b/proposals/draft/jep-015-third-party-function-registrations.md index a8ce530..769c647 100644 --- a/proposals/draft/jep-015-third-party-function-registrations.md +++ b/proposals/draft/jep-015-third-party-function-registrations.md @@ -23,10 +23,10 @@ There is currently no restrictions as to what those function names may be except that is must match the `unquoted-string` production. This proposal specifically acknowledges that third-party functions may -be used to extend JMESPath and mandates tha all third-party function +be used to extend JMESPath and mandates that all third-party function names should start with a leading underscore character. -Functions whose names starts with a letter – known or future – are +Functions whose names – known or future – starts with a letter are effectively reserved exclusively for use by JMESPath. ## Specification @@ -35,7 +35,7 @@ This JEP proposes adding the following text to the specification in the [Function Expressions](https://jmespath-unofficial.github.io/jmespath.site/specification.html#functions) section: > ### Function Expressions -> Functions allow users to easily transform and filter data in JMEPath expressions. +> Functions allow users to easily transform and filter data in JMESPath expressions. > Built-in functions are defined by JMESPath. However, a compliant implementation > MAY support registration of new functions to extend JMESPath. >