3 ms·
I haven't had the chance to test it out yet, but my impression has always been that first-class functions should be presented to imperative/OO programmers as a
by mquander 16y ago
I haven't had the chance to test it out yet, but my impression has always been that first-class functions should be presented to imperative/OO programmers as a replacement for polymorphic functions.
Frequently, for an abstraction X where I need different but similar behavior in different situations, I'll implement X by passing around functions in Scheme or Clojure, but I'd implement X with inheritance and polymorphism in C#. The frequent advantage (in my opinion) is that passing functions is more flexible, conceptually simpler, and usually shorter to write.
Do you see it that way?