Re:Ruby 3.2.0 Is from Another Dimension
by djur on Thursday January 05, 2023 @11:35PM
(#34271005)
I'm not sure how clear Strachey's definition can be, considering he never provided one. But his description of ALGOL procedures as second-class mentions that they can "never be represented by a variable or expression":
In Ruby you can assign a function to a variable, pass it to a function as a parameter, return it as the result of a function, and test two function objects for equality. Ruby has first-class functions. If it didn't, you would easily be able to provide an example of a program using first-class functions that cannot be represented in Ruby.
https://en.wikipedia.org/wiki/First-class_citizen#History
In Ruby you can assign a function to a variable, pass it to a function as a parameter, return it as the result of a function, and test two function objects for equality. Ruby has first-class functions. If it didn't, you would easily be able to provide an example of a program using first-class functions that cannot be represented in Ruby.