From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Panicz Maciej Godek Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.devel Subject: Re: anyone define port types? Date: Wed, 30 Mar 2016 21:02:22 +0200 Message-ID: References: <87y492mnjp.fsf@pobox.com> <87io046wp7.fsf@drakenvlieg.flower> <87a8lfx37i.fsf@elektro.pacujo.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b86dd2c2f05f9052f48c9e2 X-Trace: ger.gmane.org 1459364559 25779 80.91.229.3 (30 Mar 2016 19:02:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Mar 2016 19:02:39 +0000 (UTC) Cc: Andy Wingo , "guile-user@gnu.org" , guile-devel To: Marko Rauhamaa Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Mar 30 21:02:39 2016 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1alLO2-0001nb-BU for guile-user@m.gmane.org; Wed, 30 Mar 2016 21:02:38 +0200 Original-Received: from localhost ([::1]:56325 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alLO1-0002FN-CK for guile-user@m.gmane.org; Wed, 30 Mar 2016 15:02:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53089) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alLNs-0002DL-F5 for guile-user@gnu.org; Wed, 30 Mar 2016 15:02:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alLNo-0002VI-1k for guile-user@gnu.org; Wed, 30 Mar 2016 15:02:28 -0400 Original-Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:34519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alLNn-0002VD-Mn; Wed, 30 Mar 2016 15:02:23 -0400 Original-Received: by mail-wm0-x234.google.com with SMTP id p65so195597865wmp.1; Wed, 30 Mar 2016 12:02:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=IN5SLkl6WPnycD3C2AVEbhKWSdN6f4z6bPhkht1nNnY=; b=X50EIDD+mLQKDSUCJeNDrEgdzfXOF01ZoR/itkeziifE53KmLGxHzN6/wRo8Ne85aP vPbOmCLhYC84pG1kGakKMTWFNPId/Hm2zIrPMPE10Gwbvxfgo5sYqSlIJdBPsUq0GLNd 9skSObyN/GeUD3CL281wElzL3U/CLhxL7qkRtcJGmAT7rXtx+JWgOixQTGAosrfKKlKQ 6EAFj3N6qMQY/gCy0wCQEIlyluzkm2qP9HnYZiTN1qGFBPvDx0cOaGgXB/oNEOmtpD7g 6pyJLv2/MRxKdgFRwNDwYh4Xsssbrf1Pe8m3DI6veiX2xAsUKxrKVvgpnU2pSVSEywi0 0/OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=IN5SLkl6WPnycD3C2AVEbhKWSdN6f4z6bPhkht1nNnY=; b=JkdPBVBnSBEzr3RPtOAjHRTBBbqZynOqsXSY0dWH0jxzsnOxo+Bwwf+Oin32CzYc9v w+yLgAepgbWrW/mASBxUvrJ2NYMhTS9tTfGo2+FQB4m5d4V6MQ2tb6487zYietH181sS BgbYKjOxvkEXhk6zazGUlabMt9EtqvO2NInfMUAAttFhmeJCkNAj16tkYRM5T1OMMAK3 KiZjgC8Q4ywrcuO05eJmMgWqYGTPRAOUG538AbQWHxEXyz3pUaUVftSFHwYQqSTX/hAN DcKJYa7QpgiHlYBNg1TQGkQp3IHgkjp5jGus39F850ZtWbPx/cMl3xXMAJv7op8SrWih v3og== X-Gm-Message-State: AD7BkJJVpWQ9azp6VdVUb6PibCl8cKayxONeuOb4KVV+EGjBvIX754v31WqDyKaJR49XcKieniTfmhuA2H3pJw== X-Received: by 10.194.58.12 with SMTP id m12mr12437399wjq.22.1459364543004; Wed, 30 Mar 2016 12:02:23 -0700 (PDT) Original-Received: by 10.194.113.101 with HTTP; Wed, 30 Mar 2016 12:02:22 -0700 (PDT) In-Reply-To: <87a8lfx37i.fsf@elektro.pacujo.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::234 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:12529 gmane.lisp.guile.devel:18256 Archived-At: --047d7b86dd2c2f05f9052f48c9e2 Content-Type: text/plain; charset=UTF-8 2016-03-30 19:53 GMT+02:00 Marko Rauhamaa : > 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: > > l#OO-Closure> > > The problem with closures is, among others, that they are non-serializable (I think that Termite solves some of those issues gracefully) 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. > > JavaScript made a similar assumption, which -- I believe -- turned out cumbersome, because I sometimes have to pretend that it has classes despite that it doesn't. > * 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. I think it is a good rule, but it's better if you can do without state. I believe that methods *are* external to objects. Linguistically, you don't "button.press()"; you "press(button)". I also think that tying methods to objects is one of the problems of OOP, because the designer of an object has to know in advance which actions on an object are conceivable. Perhaps certain devices, like tape recorders, are modelled well within OOP -- you have a well-defined interface (like the play, rewind, fast-forward button) and a hidden internal state. But I'm afraid that this metaphor doesn't scale well. --047d7b86dd2c2f05f9052f48c9e2 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
2016-03-30 19:53 GMT+02:00 Marko Rauhamaa <marko@pacujo.ne= t>:
=
=C2=A0
I like O= OP, 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:

=C2=A0 <URL: https://www.gnu.or= g/software/guile/manual/html_node/OO-Closure.htm
=C2=A0 l#OO-Closure>


The problem with closures is, among ot= hers, that they are non-serializable (I think that Termite solves some of t= hose issues gracefully)

I have created a tiny Guile module ("simpleton") that generalizes= the
principle. In particular,

=C2=A0* You don't need classes for OOP. You only need objects.


JavaScript made a similar assumption, = which -- I believe -- turned out cumbersome, because I sometimes have to pr= etend that it has classes despite that it doesn't.
=C2=A0=
=C2=A0* Do tie methods to objects. Don't pretend methods are external t= o
=C2=A0 =C2=A0objects.=C2=A0
=C2=A0 * Don't expose the internal state of objects. Only interact with the =C2=A0 =C2=A0object through methods.
I think it is a g= ood rule, but it's better if you can do without state.

I believe that methods *are* external to objects. Linguistically, = you don't "button.press()"; you "press(button)".
I also think that tying methods to o= bjects is one of the problems of OOP, because the designer of an object has= to know in advance which actions on an object are conceivable.
=C2=A0
Perhaps certain devices, like tape recor= ders, are modelled well within OOP -- you have a well-defined interface (li= ke the play, rewind, fast-forward button) and a hidden internal state.
<= /div>

But I&= #39;m afraid that this metaphor doesn't scale well.

--047d7b86dd2c2f05f9052f48c9e2--