2 ms·
This is such an asinine argument. Function pointers and passing an environment struct in C let you do everything an OO language does. What are you unable to do
by empthought 4y ago
This is such an asinine argument. Function pointers and passing an environment struct in C let you do everything an OO language does. What are you unable to do in C that you can do in Ruby?
You can implement a type system in Scheme if you really want to, what can you do in Haskell that you can’t do in Scheme?
Just admit you are wrong, bud. It’s not as hard as you’re making it out to be. Strachey’s definition is quite clear and Ruby doesn’t have first-class functions nor first-class methods. It’s a language flaw just like Python’s lambda is a language flaw.
- djur 4y agoI'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": https://en.wikipedia.org/wiki/First-class_citizen#History 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.