5 ms·
> Ruby not having first-class functions This is simply false. Ruby has first-class functions. Not only that, it has blocks, which few other languages have.
by jonnytran 4y ago
> Ruby not having first-class functions
This is simply false. Ruby has first-class functions.
Not only that, it has blocks, which few other languages have. Ruby optimizes for the common use-case of a method that takes a single callback/piece of code, and I miss it in most other languages, including Python.
In Python, the "with" statement is super special. But in Ruby, it's just a method that takes a block. And any method can take a block, not just one per class.
https://yehudakatz.com/2010/02/07/the-building-blocks-of-ruby/ https://yehudakatz.com/2010/02/07/the-building-blocks-of-rub...
- empthought 4y agoRuby does not have first-class functions. Why do you insist on sounding so sure about something you are so wrong about? https://blog.appsignal.com/2018/09/04/ruby-magic-closures-in-ruby-blocks-procs-and-lambdas.html https://blog.appsignal.com/2018/09/04/ruby-magic-closures-in...