Hacker News new | ask | show | jobs
by tomstuart 1437 days ago
I’m interested to learn what “first-class functions” means to you. Ruby has both `Proc` and `Method` which would appear to qualify. Is your frustration that you can’t `def foo … end` and then use bare `foo` to refer to it as a value (vs invoking it)?
1 comments

My frustration is that you can't pass foo as an argument to another function.
Right, I see, because you have to say `method(:foo)` or `-> { foo }` or whatever. To me this is an acceptable syntactic trade-off in exchange for being able to invoke the method with bare `foo` (i.e. variable reads and method calls look the same) but I can see from other comments here that some people dislike that ability anyway. Vive la différence!
But you can. Method objects, proc objects, lambda objects, blocks, you've got a wealth of options here in Ruby.