3 ms·
I wish people would stop seeing blocks as different. Lambda and proc in Ruby both produce instances of Proc. That blocks are not Proc to instances in MRI unti
by vidarh 5y ago
I wish people would stop seeing blocks as different.
Lambda and proc in Ruby both produce instances of Proc.
That blocks are not Proc to instances in MRI until you name them is an optimization only, and nothing stops an implementation from making blocks Proc instances (indeed my woefully incomplete Ruby compiler does that).
I agree with you that block syntax means you're less likely to need to explicitly pass lambda/procs around, but part of the reason people get confused about this is seeing blocks as something more different than they are.