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
currently a RubyProc instance only seems to validate args if its a lambda (which is fine of course).
however I stumbled upon an "edge" case from MRI 2.3.0-preview1 where a non-lambda does validation. Hash#to_proc seems to be an exceptional case, behaves (does not seem like a bug in MRI) :
@kares I think extending RubyProc is fine but there seems to be no block semantics in the underlying method (e.g. arity must be 1 and there are no captures). So you might want to just implement call directly in StrictProc (which I would rename to HashProc).
right - seemed over complicated so I simplified with a RubyProc sub-class: kares@b24bad1
... but than I realized that won't work since the block can not stay at NULL_BLOCK due isGiven
and sub-classing a Block only mean unfinalizing the runtime Block class, is that right to do ?
closing (for now). on ruby-2.3 a custom Block sub-class has been invented (which required class Block to be no longer final) - that seems to cover all the cases without sub-classing a BlockBody : b2cac04
currently a
RubyProc
instance only seems to validate args if its a lambda (which is fine of course).however I stumbled upon an "edge" case from MRI 2.3.0-preview1 where a non-lambda does validation.
Hash#to_proc
seems to be an exceptional case, behaves (does not seem like a bug in MRI) :please review, should it get refactored in any way - does it seems like a hack to you guys to sub-class :
55fdd00 // cc @enebo @subbuss
p.s. also tried
:symbol.to_proc.call 1, 2, 3
but that seems to accept any number of arguments ... like a plain-old Ruby proc.The text was updated successfully, but these errors were encountered: