-
Notifications
You must be signed in to change notification settings - Fork 12
String composition syntax #46
Comments
My initial reaction:
|
I agree that this would be a really nice feature but implementing it will be difficult. E.g. |
My initial reaction is much like Markus's; let's not let this delay or
derail the current proposal.
Mark
…On Thu, Sep 23, 2021 at 11:34 AM Markus Scherer ***@***.***> wrote:
My initial reaction:
1. Oh no, not another complication!
2. *Something* like this *might* be ok if it's pretty explicit; I
don't like putting a property in there like "all letters" which can be
large and which will grow over time.
3. For CLDR, Mark has cooked up something similar, a concise syntax
for "ranges" of strings, something like
abcd~df=abcd|abce|abcf|abdd|abde|abdf. Used to compress language subtag
validity data.
4. I don't want this to delay our proposal, but if we might want to do
something like this, then we would need to at least require escaping of a
lot of potential syntax characters inside string literals.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#46 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJLEMB3AXPZVEITRVL5KWLUDNXNFANCNFSM5EUGL4ZQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Are we going to allow general regexps inside character classes? That seems to be the simplest way of doing this. If we go that route:
|
I really do not want to go there. That is, if and when we do this, we would end up with an algorithm in the spec for how to expand strings-with-wildcards into a fixed set of strings, rather than turning the result of a character class into some sort of nested-regex matcher. As Michael points out, depending on what wildcards are supported, this could easily yield an astronomical number of strings and thus eat a lot of memory, so we should think about security implications. |
Almost any wildcard that resolves into >1 strings can be used to cause a combinatorial explosion. I don't think that there are any useful wildcards that can be implemented safely if they all get de-sugared into strings. Examples:
|
+1 to exploring this further as a separate follow-up proposal. We don’t need to do anything special as part of this proposal since If after further investigation we decide to add this functionality, we could handle it by adding a new prefix alongside |
Discussed today with Markus, Mathias, Richard, Mark, Bradley, Shane. |
We have established that sets of strings need to be bounded.
Can we introduce helper syntax to make large-but-bounded sets of strings more friendly to write?
For example:
/[(ab?c)]/
==/[(ac|abc)]/
/[(ab{1,3}c)]/
==/[(ac|abc|abbc|abbbc)]/
/[(a[bc]d)]/
==/[(abd|acd)]/
/[(a\p{L}d)]/
== the set of all letters prefixed with "a" and suffixed with "d"I can think of a number of use cases:
The text was updated successfully, but these errors were encountered: