News for hackers. Stuff that matters.
Re:Class Hierarchies? Don't Do That by seanmcdirmid on Sunday March 30, 2014 @05:35PM (#7498046)
> The idiomatic approach here was already mentioned by dllthomas: this is a functional programming language, so use functions! Specifically, use a record of functions, with each function in the record serving the same role as a method in OO. The functions can have private data by closing over it.

This is also how one does OO programming in C: just roll your own v-table using a struct of function pointers. You don't get to close over an environment in that case, so you have to be careful to pass everything in.

Re:Class Hierarchies? Don't Do That by dllthomas on Monday March 31, 2014 @02:21AM (#7499955)
There are similarities, to be sure. One difference is that state is more often closed over than passed around explicitly.