guile-user
[Top][All Lists]
Advanced

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

Re: Article about GNU Guile and GOOPS


From: Jan Wedekind
Subject: Re: Article about GNU Guile and GOOPS
Date: Tue, 4 Mar 2014 18:00:08 +0000 (GMT)
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)

On Tue, 4 Mar 2014, Panicz Maciej Godek wrote:

Hello everybody,

2014-03-04 13:57 GMT+01:00 Jan Wedekind <address@hidden>:
[...]
  It took me a while to figure out defining constructors and dynamic
instantiation of OO primitives. I hope it'll save somebody else some time
one day.

Well, I think that I'm a similar case -- it also took me a while how
to define constructors. Perhaps patching a GOOPS manual would be a
more effective solution.

  Any comments and suggestions are welcome.

I'm really glad that the topic has finally been touched. However, I
didn't find the metaclass part particularly useful -- I think it would
be more valuable, if there were some real-life applications of
metaclasses presented, or if there was just a link to the proper
section of the GOOPS manual instead of the whole section on
metaclasses (because it doens't make the text any clearer).
Hi, I'll think about it if I find an example which motivates that better. Maybe I'll add a comparison to how Ruby does it. Java, Ruby, C++, and Python all let you define static methods, i.e. metaclasses are defined implicitely.

What I find lacking is a criticism, or at least some reference to the
more contemporary approaches to OOP (such as Ruby or Python or Java).
Ok, thanks for the feedback.

I have been using GOOPS quite extensively, and I personally find it a
little controversial. For one, because there's no standard and
portable OOP framework for Scheme. This lack of portability is of a
big concern to me.
Yes. However once you have a standard portable OOP framework, you will face the evolution dilemma: If you change the software, you risk loosing stakeholders in the short term. If you avoid change, you will be outcompeted in the long term.

Besides, I think that Scheme + OOP has its own flaws. In most OOP
languages, you have this notation object.property or object->method(),
which also allows for chain calls, i.e. object->getChild()->method(),
or -- if you have nested objects -- to use
object.property.propertys_property.

If you want to obtain a uniform access to slots (i.e. without the
#:getter and #:setter -- which are a surprising way of introducing new
definitions to a module), you need to use slot-ref and slot-set!. This
quickly becomes horrible when you have nested calls:
(slot-ref (slot-ref object 'property) 'propertys-property)
[The same applies to vectors, arrays, hash tables and other stuff].
I managed to create a workaround (using the GOOPS multi-method
dispatch, read-hash-extend and procedure-with-setter) that allows me
to write
#[object 'property]
and
#[object : 'property : 'propertys-property]
(it also supports vectors and hashes and so on) and although it helps
a little, I'm not particularly happy with that solution.
It is available here, if anyone's interested:

http://hg.gnu.org.ua/hgweb/slayer/file/d5302c97b90d/guile-modules/extra/ref.scm
I think that's a good point. AFAIK in Clojure they have a notation for chaining method calls, too.



reply via email to

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