Comment by vidarh

Comment by vidarh 14 hours ago

0 replies

As much as I love Ruby (and I love it a lot - I right now have Claude fix eigenclass compilation issues in another window in my long-languishing Ruby compiler hobby project), this is also the root of a lot of confusion.

Ruby has two types of closures: lambda's, where return returns to the caller, and proc's/blocks where return acts as a return in the defining scope.

Beginners often struggle with the distinction between lambda and block, and often will be wildly confused if they ever see "proc" in the wild.

Yet lambda and proc both return a Proc object, and if you take the value of a block, you also get a Proc object... Just with different return semantics...

It'd be nice if this was a bit clearer.