4 ms·
Having to work on Puppet custom facts and functions I don't ever really feel like I've got a good understanding of what's going on under the covers with Ruby's
by nightfly 7y ago
Having to work on Puppet custom facts and functions I don't ever really feel like I've got a good understanding of what's going on under the covers with Ruby's meta-programming. And having blocks being a distinctly different thing from lambdas (and seemingly different from every other data type in the language) just makes it more confusing. Plus having blocks being passed as something that's not really a parameter(?) is just an extra complexity that wasn't really needed.
Ruby was the first non-PHP programming language I learned, and I used to love writing scripts in it, that I now write in Python instead, but the complexities outlined above kept me from ever wanting to write any complicated/large projects in it.
- vinceguidry 7y agoRecommend the now out-of-print book Metaprogramming Ruby to grant insight into the hows and whys of metaprogramming. Also serves as a decent intro to Ruby for intermediate coders. Criminal that you have to buy it on the secondary market now.
- actsasbuffoon 7y agoBlocks are just a convenient way to create and pass a proc. They aren’t a special data type. Lambdas and procs are similar. The only real differences are that lambdas check to see if they have the correct number of arguments, and returning inside a lambda returns from the enclosing scope.