-
Notifications
You must be signed in to change notification settings - Fork 82
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
keep properties of given blocks #278
Comments
Looks like every Block being passed is wrapped into a lambda. Even if there's no "subcontract" checking the blocks parameters.
Given that, the problem can be solved for all cases in which there's no Func check in the Contract.
By this, the block will only be wrapped into a lambda if there's a Func check in the Contract. So if you need the block to stay identical (like I do), you can't use that Func feature. But with this patch it's still possible to use Contracts in general, as long as you don't use Func checks.
P.S. But I'm not sure if it's ok to assign the new lambda to the existing
|
Since #242 (Func contract's return value isn't enforced with blocks) was fixed in contracts-0.15, given blocks are being put into a lambda. So the forwarded block isn't 100% identical with the original one. Especially it's
arity
and it'ssource_location
changed.Please keep as many properties as possible of the original block, especially the arity.
Or find a way to forward the original block without breaking #242 again. So the original block could be kept. I'd really appreciate any ideas for this, because it might be the cleanest solution!
Commit for #242, introducing this bug: 13e56bd#diff-a45dd775c2769b9ab16a23f9d4560adc
lib/contracts/call_with.rb
I especially need the arity to stay unchanged. Some examples about arity:
A very "simple" way how to keep the arity is using eval (see below). But I hope we find a better way.
The text was updated successfully, but these errors were encountered: