4 ms·
In Ruby if else is not a method for some reason also blocks are not objects for some reason "seems inelegant"
by rat87 4y ago
In Ruby if else is not a method for some reason
also blocks are not objects for some reason
"seems inelegant"
- chrisseaton 4y ago> In Ruby if else is not a method for some reason This is because there’s not a good way to pass two delayed computations - two blocks. Looping constructs were replaced by method variants. > also blocks are not objects for some reason Yeah they’re reifiable but not sure why not reified by default.
- rat87 4y agoBut passing two blocks/lambdas/etc doesn't inherently need to be that difficult it's not in other languages. I don't know that much about Ruby's implementation but I think both the if else and blocks not being objects are that way to prevent Ruby from being even slower. My understanding is if you turn a block into a proc it gets a lot slower.