Closed breunigs closed 6 years ago
Thank you for the review, I think your suggestions make a lot of sense. Can you take a peek if the comment for the meta programming are understandable? I was also not quite sure what you meant by spacing out
, but I hope my changes make it easier to read?
Sure thing. Please note that I will have to drop 1.9 support then, though.
One other possible option is to use the old school def foo(..., options = {}); options[:fail_fast] ...
syntax to get 1.9-compatible syntax that looks like optional named parameters.
That said, I just looked and 1.9's been EOL'ed for over three years now (Feb 2015), so I think it's time. I was previously keeping 1.9 support around because this gem was a transitive dependency for stripe-ruby
, which supported 1.9, but we dropped 1.9 there, so it's safe to drop it here too.
Thank you for the review, I think your suggestions make a lot of sense. Can you take a peek if the comment for the meta programming are understandable?
Awesome. Looks great! Thanks for the quick turnaround.
I was also not quite sure what you meant by spacing out, but I hope my changes make it easier to read?
I just meant that we should put an empty line above and below so that the code isn't quite so dense. You've already done it here, so all good!
Released as 0.19.0.
I experimented quite a bit with a decent fail fast solution. There's two tricky parts:
allOf
,anyOf
andoneOf
)Doing any kind of meta programming in the
and
method or similar makes the normal case 1/3rd slower, at least in all the ideas I tried. Trying to work without throw/catch makes the code rather unwieldy, at which point I think the speedup is not worth the additional maintenance effort anymore.This branch has the following timings:
I have not looked into details if the .85 percentage points for the "fail slowly w/ meta" case are by chance or if's due to the extra work of having to define the method in the beginning. I think with all the other improvements, this loss of performance might be acceptable.
If you're generally fine with this approach, I'll also amend the readme to cover this additional capability.