News for hackers. Stuff that matters.
Re:I learnt C++ in 2018 and have no regrets by TeMPOraL on Monday January 07, 2019 @01:36PM (#18848384)
> Not really. In fact in Lisp OO is the opposite, the functions are explicitly keeped away from the data.

Common Lisp really opened my eyes here. Initially it felt weird to have methods[0] living completely independently from classes, but over time I realized that where classes and objects implement nouns, generic functions and methods represent verbs, and in a language the verbs are an independent domain from nouns, representing their own generalized concepts that's unrelated to the taxonomy of nouns.

--

[0] - A "method" in CLOS is an individual implementation of a "generic function". So e.g. you could have a generic function `(defgeneric draw (device figure))`, and then specific implementations dispatching on any combination of arguments; e.g. `(defmethod draw ((device printer) figure)` to draw any kind of figure on a specific device, or `(defmethod draw (device plotter) (figure circle))` to draw a specific thing on a specific device, etc.

There are no comments on this comment yet.