unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Jan Wedekind <jan@wedesoft.de>
To: Marko Rauhamaa <marko@pacujo.net>
Cc: Andy Wingo <wingo@pobox.com>,
	"guile-user@gnu.org" <guile-user@gnu.org>,
	guile-devel <guile-devel@gnu.org>
Subject: Re: anyone define port types?
Date: Wed, 30 Mar 2016 22:01:41 +0100 (BST)	[thread overview]
Message-ID: <alpine.DEB.2.11.1603302151520.12120@wedemob> (raw)
In-Reply-To: <87shz7vifl.fsf@elektro.pacujo.net>

On Wed, 30 Mar 2016, Marko Rauhamaa wrote:

> Jan Wedekind <jan@wedesoft.de>:
>
>> 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
>
> Your example demonstrates my problem with GOOPS: you are redefining
> (display) by penetrating the black box with (slot-ref). What would
> happen to your method if I changed the implementation of <a> so it
> no longer has the slot x, even virtually.
>
> GOOPS' has the worst possible object model: objects are seen as mere
> data records. The concept of a "slot" is an anathema to OOP.
>
> Think of a UNIX file. You access it through open(2), write(2), read(2),
> close(2) and so on. You don't know and you shouldn't care how the file
> contents are organized on the disk (if there is a disk!). GOOPS would
> like to abandon the system calls and just expose the bytes (slots) on
> the disk. Then, GOOPS lets you define any kind of system calls you see
> fit.
>
>
> Marko
Ok, I have updated the example to use accessor functions instead of 
"slot-ref". But yes, a GOOPS generic only dispatches on types where 
instances in turn need to define slots (attributes). That's why I pointed 
out Clojure multimethods which uses a more flexible dispatch mechanism 
(using an inheritance graph and dispatching on the return value of an 
arbitrary function).

GOOPS (as well as Clojure multimethods) provide "open" classes and 
multiple-dispatch. Two things which I can really recommend to play with.



  reply	other threads:[~2016-03-30 21:01 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-28 19:04 anyone define port types? Andy Wingo
2016-03-28 23:53 ` Matt Wette
2016-04-05 14:06   ` Mark H Weaver
2016-04-05 23:55     ` Matt Wette
2016-06-11 16:50       ` Andy Wingo
2016-03-29  7:58 ` tomas
2016-03-29  8:52 ` Nala Ginrut
2016-03-30  6:29 ` Panicz Maciej Godek
2016-03-30 11:18   ` Jan Nieuwenhuizen
2016-03-30 17:17     ` Panicz Maciej Godek
2016-03-30 17:53       ` Marko Rauhamaa
2016-03-30 19:02         ` Panicz Maciej Godek
2016-03-30 19:57           ` Marko Rauhamaa
2016-03-31 16:11             ` Barry Fishman
2016-03-31 19:28               ` Marko Rauhamaa
2016-03-30 19:43         ` Jan Wedekind
2016-03-30 20:07           ` Marko Rauhamaa
2016-03-30 21:01             ` Jan Wedekind [this message]
2016-03-30 22:44               ` Marko Rauhamaa
2016-03-31 20:42                 ` Jan Wedekind
2016-03-31 22:28                   ` Marko Rauhamaa
2016-06-11 16:53   ` Andy Wingo
2016-04-01 14:38 ` Ludovic Courtès
2016-06-11 16:57   ` Andy Wingo
2016-04-14 14:08 ` Ludovic Courtès
2016-06-11 17:02   ` Andy Wingo
2016-06-12  8:25     ` Chris Vine
2016-06-19  9:13       ` Andy Wingo
2016-06-19  9:55         ` Marko Rauhamaa
2016-06-19 15:27           ` Andy Wingo
2016-06-19 15:33         ` Chris Vine
2016-06-19 17:48           ` Andy Wingo
2016-06-19 20:09             ` Chris Vine
2016-06-20  3:38               ` William ML Leslie
2016-06-20  6:45                 ` Chris Vine
2016-06-20  7:34                   ` Andy Wingo
2016-06-20  9:01                     ` Chris Vine
2016-06-22 22:44                       ` Chris Vine
2016-06-23  7:36                         ` Andy Wingo
2016-06-23  8:56                           ` Andy Wingo
2016-06-23  9:24                           ` Chris Vine
2016-06-23  9:50                             ` Marko Rauhamaa
2016-06-23 10:43                             ` Andy Wingo
2016-06-23 11:49                               ` William ML Leslie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.11.1603302151520.12120@wedemob \
    --to=jan@wedesoft.de \
    --cc=guile-devel@gnu.org \
    --cc=guile-user@gnu.org \
    --cc=marko@pacujo.net \
    --cc=wingo@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).