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

SE-0351 was accepted with mapOutput, but it's not implemented #668

Open
tevelee opened this issue May 4, 2023 · 3 comments
Open

SE-0351 was accepted with mapOutput, but it's not implemented #668

tevelee opened this issue May 4, 2023 · 3 comments
Assignees

Comments

@tevelee
Copy link

tevelee commented May 4, 2023

The proposal for SE-0351 defines a way to map the output of a regex component to reorder captures, flatten nested optionals, or create instances of a custom type. See https://github.com/apple/swift-evolution/blob/main/proposals/0351-regex-builder.md#mapping-output
The proposal was accepted and its status is declared as Implemented (Swift 5.7), but this feature was left out from the compiler.

This is a crucial feature, and I miss it a lot whenever I deal with regexes in Swift. It's not possible to implement it as an extension by external users of the API, because it should have been a builtin component in the DSL tree.

I only found traces of it in the codebase, the PR #455 that implemented it was closed and the follow-up #466 is still in draft.

@tevelee
Copy link
Author

tevelee commented May 4, 2023

cc @milseman

@milseman milseman self-assigned this May 18, 2023
@sena-mike
Copy link

This pretty much flattens out all regexes to a single level and limits how much composition can be done into custom types. Hope this gets some attention for the next release of Swift

@haikusw
Copy link

haikusw commented Dec 11, 2023

Want this also. Nested tuples to support nested Captures would be better than nothing but a way to capture and return custom types to group multiple captures into structs would be better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants