You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to update some code that I think could really benefit from a functional style. Here's the current code:
letkeyPaths:[WritableKeyPath<Config,String>]// ...
for keyPath in keyPaths {config[keyPath: keyPath]=try evaluator.evaluateExpression(config[keyPath: keyPath])}
The problem
I've tried a few different approaches and none of them compile because evaluateExpression is a throwing function, and the overture functions I'm trying to use don't have rethrows. Here's my best attempt:
letevaluators= keyPaths.map{over($0, evaluator.evaluateExpression)}
for evaluateField in evaluators {
config =tryevaluateField(config)}
Potential solutions
I'm missing something and there's a better way to do this with a function that does have rethrows
Add rethrows to all of the methods except where it doesn't make sense (I feel like over and co make sense to have rethrows)
The text was updated successfully, but these errors were encountered:
stackotter
changed the title
Potentially add throwing regrows to over and similar functions
Potentially add regrows to over and similar functions
Mar 4, 2022
stackotter
changed the title
Potentially add regrows to over and similar functions
Potentially add rethrows to over and similar functions
Mar 4, 2022
stackotter
changed the title
Potentially add rethrows to over and similar functions
Potentially add rethrows to over and similar functions
Mar 4, 2022
Context
I'm trying to update some code that I think could really benefit from a functional style. Here's the current code:
The problem
I've tried a few different approaches and none of them compile because
evaluateExpression
is a throwing function, and the overture functions I'm trying to use don't haverethrows
. Here's my best attempt:Potential solutions
rethrows
rethrows
to all of the methods except where it doesn't make sense (I feel likeover
and co make sense to haverethrows
)The text was updated successfully, but these errors were encountered: