3 ms·
I'm not so sure about the block thing. I mean I like having first class function-like objects, but you've got blocks and procs and both of these are different
by mikekchar 8y ago
I'm not so sure about the block thing. I mean I like having first class function-like objects, but you've got blocks and procs and both of these are different from bound and unbound methods. I would prefer that there was a single function type, personally. I wonder if I'm missing something, though. Is there an advantage to distinction between blocks and procs that ruby makes?
- ravenstine 8y agoA block is a proc. ```ruby def foo &bar return bar end foo {} # => #<Proc:0x00007ff23783c4e0@(irb):16> ``` But I do agree that I don't quite understand the need for the distinction between procs and methods, or the need for unbound methods; I would think that methods could just be either bound to one object or another, as unbound methods are useless for the fact that they won't work at all unless they are bound.
- int_19h 8y agoI think they rather meant the difference between procs and lambdas (e.g. wrt return).