4 ms·
You can create that Proc from implicit block on demand by calling `Proc.new` without a block.
by _mikz 12y ago
You can create that Proc from implicit block on demand by calling `Proc.new` without a block.
- deleted 12y ago[deleted]
- masklinn 12y agoAt which point you eat the reification cost. It's real easy to test too: just bench def a flag Proc.new if flag nil end with the flag set to `true` or `false`. Note that the proc is never actually called or returned to a possible caller, the only difference is that one reifies the proc and the other one not. You'll get roughly the same 5x difference (with `flag=false` being the fastest) as TFA notes.
- _mikz 12y agoYes. But only when you actually need it (for example to store/pass it).
- deleted 12y ago[deleted]
- stormbrew 12y agoNote that this was actually the original way to do so. The &block argument format was added later.