On Wed, 30 Mar 2016, Marko Rauhamaa wrote:
Panicz Maciej Godek <godek.mac...@gmail.com>:
2016-03-30 13:18 GMT+02:00 Jan Nieuwenhuizen <jann...@gnu.org>:
Panicz Maciej Godek writes:
I also used GOOPS, which I regret to this day, and so the
whole framework needs a serious rewrite
What is it that you do not like about GOOPS?
Most specifically, I dislike its middle three letters. The problem
with OOP is that it requires to know exactly what ones want -- it is
difficult to change the design of your program after it's been written
(and it is also difficult to come up with a good design from the
beginning), and -- since it is based on state mutation - it makes it
difficult to reason about your program.
On the practical side, it was a bit counterintuitive that <uvec> and
<vector> were unrelated, and I think that there were some issues with
<pair> and <list> types.
I like OOP, only I don't like GOOPS. Its classes and generic functions
seem so idiomatically out of place, unschemish, if you will.
This is how OOP ought to be done:
<URL: https://www.gnu.org/software/guile/manual/html_node/OO-Closure.htm
l#OO-Closure>
I have created a tiny Guile module ("simpleton") that generalizes the
principle. In particular,
* You don't need classes for OOP. You only need objects.
* Do tie methods to objects. Don't pretend methods are external to
objects.
* Don't expose the internal state of objects. Only interact with the
object through methods.
Marko
GOOPS supports "open" classes and multiple-dispatch. E.g. you can extend
the "write" method to control how an object is displayed within the Guile
REPL [1]. Another interesting approach are multi-methods in Clojure which
don't even require explicit types for dispatching.
[1] http://wedesoft.de/oop-with-goops.html