3 ms·
fluent interfaces from OOP are different than composition because they mutate-and-return the object reference; if the instance is aliased anywhere else in the p
by dustingetz 10y ago
fluent interfaces from OOP are different than composition because they mutate-and-return the object reference; if the instance is aliased anywhere else in the program there is spooky-action-at-a-distance. Composition is about programming with values without mutation. As far as syntax goes it is a trivial macro to translate `x.f().g()` into `g(f(x))` (clojure actually provides it : http://clojure.org/guides/threading_macros http://clojure.org/guides/threading_macros)
- yawaramin 10y ago> they mutate-and-return.... Not necessarily; you can easily write instance methods which merely copy the existing object.