replaceError(with ...)
as @autoclosure?
#134
Replies: 2 comments 3 replies
-
Hey @randomeizer, as you were posting this, I was submitting the PR #132. I've tried the |
Beta Was this translation helpful? Give feedback.
-
Interesting idea! I think we'd probably want to benchmark such a thing to see how it impacts parsing. I imagine most constant Notably, the equivalent operation in combine does not employ an auto-closure: https://developer.apple.com/documentation/combine/publisher/replaceerror(with:) |
Beta Was this translation helpful? Give feedback.
-
Just wondering if it would make sense to have this:
https://github.com/pointfreeco/swift-parsing/blob/85e1c50d03999a2b53d30ddae4d0f2a3d872b335/Sources/Parsing/Parsers/ReplaceError.swift#L36-38
as:
(with requisite adjustment in
Parsers.ReplaceError
'sinit
). Otherwise a potentially-expensive default output is always getting generated, even if it's never used.Beta Was this translation helpful? Give feedback.
All reactions