unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Barry Fishman <barry@ecubist.org>
To: guile-user@gnu.org
Cc: guile-devel@gnu.org
Subject: Re: anyone define port types?
Date: Thu, 31 Mar 2016 12:11:08 -0400	[thread overview]
Message-ID: <m360w2sk4j.fsf@ecube.ecubist.org> (raw)
In-Reply-To: 87zitfvivu.fsf@elektro.pacujo.net


On 2016-03-30 22:57:25 +0300, Marko Rauhamaa wrote:
> Panicz Maciej Godek <godek.maciek@gmail.com>:
>
>> 2016-03-30 19:53 GMT+02:00 Marko Rauhamaa <marko@pacujo.net>:
>> The problem with closures is, among others, that they are
>> non-serializable
>
> What is there to serialize in objects? How do you serialize a car? How
> do you serialize an ant? How do you serialize a person?
>
> All you can serialize is information. Objects are living things we
> experience through interactions alone.

Do we really want our computers to behave like organic black boxes?

I think is is more limiting to look at Objects as organic entities
rather than encapsulation of state.  If objects are state they can be
recorded.  When your bank account balance looks wrong its good to be
able to replay transactions to find out what you are missing.  When
transactions are happening across a network its nice to be able to
restart them rather deal with lost transactions or single points of
failure.

Yes, Objects can produce their own logs, but this becomes more code to
debug rather than a better debugging tool.  And the act of building such
an interface, really establishes them as state.

It is nice to think about the fact that a single implementation of that
state is not required by a design, or that it can be changed with little
impact on the rest of the system.  But such implementation flexibility
is not dependent on a "methods within object" type of object construction.
It is more a matter of what is exported at the module level.

In Guile you can export, at the module level, what interface you like
and hide any raw "get-x" style assessors.  True you can get at raw state
through the slot interface, but Guile is built around observably, not
security, and you could get at the contents of closures if you really
wanted to.  The fact that objects represent state doe not force the
exact implementation of that state be considered outside of a single
module.

> And yet, UNIX knows how to suspend a process. Virtualization
> technologies are very good at snapshotting live virtual machines. Tricky
> business but the results are quite impressive albeit not fully
> flawless.

And a crude way to try to deal with this.  Serialization does not have
to be lost.

I used to do large scale development in C++.  Books like "Design
Patterns" are really just series of hacks to get somewhat around the
fact that objects built around a fixed, rigidly defined set of methods
becomes difficult to adapt and maintain as projects grow over time.  I
found that Common Lisp's CLOS style way of looking at objects would have
made thing far easier to develop and maintain and produce a more stable
code base.  I really got to dislike C++'s and Java's object model.

With distributed environments and the more functional way of looking at
things that are possible in Scheme, I think we would better off allowing
for extending objects by treating them as immutable state and using
monads to perform actions, rather than just allowing for mutable objects
and methods.  Monads don't constrain object state implementation either.

I don't mean this to be construed as trying to make Guile a purely
functional language.  I like choices.

>> 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.
>
> You mean you can't associate new methods to an object. That's true and
> can be annoying sometimes. However, GOOPS' cure is worse than the
> disease: it exposes the slots of the object.

What is exposed or not exposed seems to be something better handled by
what modules export, and not be intrinsic to objects themselves.  This
allows methods, defined outside the module, that uses just the module
interface to the object (or several objects) to be easily defined and
somewhat separately manged.  This becomes crucial as systems grow and
change.  Especially allowing for the idea of multi-methods.

One of the security issues with Apple's Objective C is that object
methods are always available, if you know about them.  Closure based
interfaces do make hiding of state easier, but I think localizing all
method code in one place makes complex large systems more difficult to
maintain.  Of course at the true security level, both can be hacked.  We
are dealing more with what developers might presume about an interface
rather a malicious act.

Although Scheme itself is not the usual place to think about complex
systems, I think Guile does, given what is currently being implemented.

--
Barry Fishman




  reply	other threads:[~2016-03-31 16:11 UTC|newest]

Thread overview: 43+ 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  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 [this message]
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
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=m360w2sk4j.fsf@ecube.ecubist.org \
    --to=barry@ecubist.org \
    --cc=guile-devel@gnu.org \
    --cc=guile-user@gnu.org \
    /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).