top | item 34250194

(no title)

jonnytran | 3 years 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-rub...

discuss

order