Ruby does have first class functions. What makes you think it doesn’t?
From wikipedia: A language that has first-class functions is one where:
The language supports constructing new functions during the execution of a program, storing them in data structures, passing them as arguments to other functions, and returning them as the values of other functions.
You’re probably hung up on the fact that Ruby’s Procs/Lambdas need to be invoked via a call()
but this does not impact on their firstclassness. Common Lisp lambdas are invoked with a funcall
as well and I do not recall anyone claiming Common Lisp does not have first class functions.
2
solved Javascript can implement OOP but Ruby can’t implement functional programming? [closed]