guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: anyone define port types?


From: Jan Wedekind
Subject: Re: anyone define port types?
Date: Wed, 30 Mar 2016 20:43:57 +0100 (BST)
User-agent: Alpine 2.11 (DEB 23 2013-08-11)

On Wed, 30 Mar 2016, Marko Rauhamaa wrote:

Panicz Maciej Godek <address@hidden>:

2016-03-30 13:18 GMT+02:00 Jan Nieuwenhuizen <address@hidden>:

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]