-
-
Notifications
You must be signed in to change notification settings - Fork 308
Clarify which regular expression production rule from the ECMA specification is intended #821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@Julian I thought we address this in https://github.com/json-schema-org/json-schema-spec/pull/775/files |
A ha, that does certainly seem relevant -- possibly the confusion leftover though is that section doesn't appear in the version of the ECMA262 spec that's linked -- that section from your PR looks like it refs 2011 ECMA spec, but the one linked in the current JSON Schema spec links the 2018 one -- though presumably the intention is the corresponding section in the new version of the spec I guess? Which probably answers the original question here (I think meaning \a should be an error, but will have to double check) |
We should specify which "edition" of ECMA262 we are referencing. Which version do we want to reference? |
I think to work this out, we should consider:
|
Interestingly, OAS 3.0 references ECMA 262 sec-7.8.5 (https://www.ecma-international.org/ecma-262/5.1/#sec-7.8.5). A literal includes flags. |
In the unreleased v3.0.3 this should have been fixed by PR OAI/OpenAPI-Specification#1987 |
I haven't been able to easily determine what the differences / changes to the relevent sections of the document from edition 5.1 to edition 10... at least no one is telling me and reading to find out will be time consumig! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
After discussion on the OAS TSC call (2020-07-09), no one had an idea which edition of ECMA should be referenced. We need to find someone who knows ECMA and what might have changed between editions. We should consider if the most recent edition has been implemented fully by major implementers. |
This blog post indicates RegExp lookbehind assertions were added in ES2018, but caniuse only gives that a 'score' of 71.65% of global users having that support in browsers (other regex features rate 95%+). Using that as a rough guide to tool support, perhaps therefore we should cite an edition of the ECMA spec < 2018 (whichever edition that is). |
also related: json-schema-org/JSON-Schema-Test-Suite#380 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@karenetheridge so looks like that issue was referencing ECMA edition 10 rather than 5.5 like the spec. Would you be able to evaluate if that might have caused a problem please? =] |
@Relequestual I don't understand the various ECMA dialects well enough to give a clear response here. |
You and me both... |
@ljharb Way ahead of you on the Unicode support: json-schema-org/JSON-Schema-Test-Suite#264
... Ultimately though, we had to move those tests to an optional suite because it turns out .Net doesn't support multibyte characters (surrogate pairs) in regular expressions, at all. We've had poor experiences with "living standards" on the whole; and the IETF process, and most of us it looks like, strongly prefer publishing documents whose meaning doesn't change over time. My own reasoning is since this is a normative reference, it's more akin to incorporating that specification piece entirely, not merely referring to it; and our selection of ECMA-262 is aiming to establish a least-common-denominator syntax likely to be supported across the hundreds of various regular expression dialects & implementations. (If supporting the latest features were the goal, we would point to the IANA Media Type Registry instead, so as to always point to the latest publication—if there were a media type to reference, that is.) |
+1000000000000000
Yeah exactly. In practice, the vast majority of implementations use whatever regex library is common in their language. And if people want to get ultra-precise about regex features, that's what extension vocabularies are for. You could add |
That’s fine; but a) I’d encourage you to rapidly update the normative reference every June to the latest edition, so you stay up to date intentionally; b) if you can point me to which parts of 262 you depend on, i can (as editor) add an editor’s note to make sure they’re not changed without at least pinging stakeholders such as yourselves. |
Appreciate the offer there, but I believe the way we DO references are by number, with the actual link to just the specification itself, as opposed to deep linking directly (allowing for multiple references). Unless anyone gives us a compelling reason to reference the latest version of ecma262, I'm going to update our reference to point to the "historic" 5.1 version of ecma262 to avoid ambiguity. |
I'd strongly suggest not doing that, since the spec around JSON changed in ES2019 (tc39/ecma262#1396 and tc39/ecma262#1188 in particular). I think it is a very unwise idea to point to obsolete snapshots of any specification, and I really hope you don't choose to do so. |
@Relequestual I think it's good advice, is there any reason NOT to link to the latest snapshot? We reference the document, of course, but the URL can still be to the section/paragraph in question. |
@awwright I assume you don't mean "the latest snaptshot URL", which would mean we would point to to a living standard document (which can be updated), which as you said earlier, we do not want. We can point to the current latest version (11th edition (June 2020)), I have no problem with that, but I don't see any compelling reason why we should do so. While specific regex dialect support is optional as per the spec, it's going to be hard for anyone to be fully compliant, especially for browser based tooling as noted. If we DO link to the latest and greatest, are we happy to accept the fact that 100% supporting all the optional parts of the spec, namly correct regex support, just simply won't be possible right now? |
/remind me to merge the PR and close this issue if there's been no discussion in 7 days! |
@Relequestual set a reminder for Oct 4th 2020 |
After some responses to a tweet, it looks reasonable to move to the current latest version. Here's a list of "finished proposals" for tc39: https://github.com/tc39/proposals/blob/master/finished-proposals.md It looks like the two relevant changes are: Both of which were published as part of the 2018 version. I conclude that moving to the latest version makes sense given general support, and given support for the specific syntax is optional anyway. |
Lookbehind assertions are currently not supported by Safari (both desktop and mobile): https://caniuse.com/js-regexp-lookbehind |
Apparently the u flag in ECMAScript makes some regular expressions invalid, specifically, unnecessary escapes: tdegrunt/jsonschema#311 |
@awwright We already previously reference ECMAScript. That hasn't changed. |
It would also be ideal to only ever use the |
Reference ECMAScript 11.0 specifically (#821)
Draft 2020-12 now references the ECMA 262 11.0 specification, and thereby does not allow \a. Refs: json-schema-org/json-schema-spec#821 Closes: #309
Via @leadpony in json-schema-org/JSON-Schema-Test-Suite#309 [the context being "what behavior is expected if one uses
\a
, i.e. ASCII BEL, within a regular expression]:We should clarify which behavior is intended, and therefore whether such a string is or is not a valid regex for the test suite.
The text was updated successfully, but these errors were encountered: