Skip to content
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

namespaces: validate and extract uses the strictly split a string in a vague manner #1134

Closed
dlrobertson opened this issue Dec 12, 2022 · 3 comments · Fixed by #1135
Closed
Labels
clarification Standard could be clearer

Comments

@dlrobertson
Copy link
Member

Namespaces validate and extract uses strictly split a string in the following step:

  1. If qualifiedName contains a U+003A (:), then strictly split the string on it and set prefix to the part before and localName to the part after.

strictly-split defines the result as a list, so "the part before" and "the part after" feels a bit vague. Due to the validation in step two and the branch condition the list will have two elements, but it would be a bit clearer to use list indexing.

@dlrobertson
Copy link
Member Author

dlrobertson commented Dec 12, 2022

To what extent is it helpful to be explicit about things? When thinking about a step like this, I tend to think of something like:

  1. If qualifiedName contains a U+003A (:), then run the following steps:
    1. Let splitResult be the result of strictly split given qualifiedName and U+003A (:).
    2. Set prefix to splitResult[0].
    3. Set localName to splitResult[1].

Unwrapping things like this feels a bit verbose. Is there a better way?

@annevk
Copy link
Member

annevk commented Dec 12, 2022

You can leave out " run the following steps".

@domenic did we start using

Let [prefix, localName] be the result of ...

already?

Even without that though your version is clearer and I'd definitely support moving to that.

@domenic
Copy link
Member

domenic commented Dec 13, 2022

We've been doing it as "Let (prefix, localName) be the result of..." but only for tuples, not lists. (And it's not documented anywhere.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer
Development

Successfully merging a pull request may close this issue.

3 participants