unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: David Thompson <dthompson2@worcester.edu>
To: Panicz Maciej Godek <godek.maciek@gmail.com>
Cc: Carlos Pita <carlosjosepita@gmail.com>,
	"guile-user@gnu.org" <guile-user@gnu.org>
Subject: Re: A couple of questions about goops method parameters
Date: Fri, 05 Sep 2014 15:55:28 -0400	[thread overview]
Message-ID: <87vbp1q1u7.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <CAMFYt2b4sj5uO80q0T=ErDhuUuW5p5qrcdHZPSnhepU60maORw@mail.gmail.com>

Panicz Maciej Godek <godek.maciek@gmail.com> writes:

> 2014-09-05 21:12 GMT+02:00 David Thompson <dthompson2@worcester.edu>:
>> Panicz Maciej Godek <godek.maciek@gmail.com> writes:
>>>
>>> So perhaps you could tell me how to design a GUI framework in FP and
>>> without OOP. To me it seems that GUI is the main domain the OOP was
>>> crafted for, but if you have some nice functional ideas, perhaps you
>>> could help me to redesign my framework.
>>>
>>
>> Are you familiar with functional reactive programming?
>>
>> http://elm-lang.org/learn/What-is-FRP.elm
>>
>> Using FRP, we can model with mutable state in a pure, functional way.
>> That is, the necessary mutation is hidden behind the runtime of the FRP
>> implementation.
>>
>> Just some food for thought.
>
> Sure, I've been reading a lot, but I didn't manage to get much of it.
> I mean, the toy examples are really nice, but it's hard for me to see
> the advantage of FRP over OOP in practical systems (e.g. windowed
> applications with buttons and so on). Although I see value in
> encapsulating state mutations, the notion of state seems inevitable in
> describing such applications (like the mere fact that a checkbox can
> be checked or not -- so it's a state which is a part of the
> description).
>

Yes, it's state, and state will always be there in a realtime
application.  However, you can still model it in a functional way with
procedures that are idempotent and objects that are immutable.  You just
need to glue it all together with something that tracks the current
state of the application.

> BTW I recently ran into a problem with your signal propagation
> framework from (guile 2d). Namely, if a signal is itself a mutable
> object (like a vector or an array), then changing the value of that
> object doesn't propagate (because it happens only when you use
> slot-set!, and not (vector-set! (slot-ref ...)...)).
> I can't find any workaround for that.

I don't consider it a problem because the values stored signals are
intended to be immutable.  I will make that clear when I get around to
documenting things better.  If you mutate an object within the signal
graph, bad things are bound to happen.  The only reasonable side-effects
are those that do not change values stored within signals, like writing
to a log file or playing a sound.  I have intentionally kept mutation at
lowest layer of the system, abstracted away from the user.

-- 
David Thompson
Web Developer - Free Software Foundation - http://fsf.org
GPG Key: 0FF1D807
Support the FSF: https://fsf.org/donate



  reply	other threads:[~2014-09-05 19:55 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03  2:05 A couple of questions about goops method parameters Carlos Pita
2014-09-03 15:49 ` Carlos Pita
2014-09-03 16:47   ` Marko Rauhamaa
2014-09-03 18:05     ` Carlos Pita
2014-09-03 16:20 ` Panicz Maciej Godek
2014-09-05  8:32 ` Nala Ginrut
2014-09-05 12:47   ` Carlos Pita
2014-09-05 19:03   ` Panicz Maciej Godek
2014-09-05 19:12     ` David Thompson
2014-09-05 19:35       ` Panicz Maciej Godek
2014-09-05 19:55         ` David Thompson [this message]
2014-09-05 20:10         ` Taylan Ulrich Bayirli/Kammer
2014-09-05 20:50           ` David Thompson
2014-09-07 10:33           ` Neil Jerram
2014-09-07 15:27             ` Taylan Ulrich Bayirli/Kammer
2014-09-05 20:10         ` Panicz Maciej Godek
2014-09-05 20:18           ` Taylan Ulrich Bayirli/Kammer
2014-09-05 20:37             ` Panicz Maciej Godek
2014-09-05 20:51               ` Marko Rauhamaa
2014-09-05 21:53                 ` Taylan Ulrich Bayirli/Kammer
2014-09-05 22:26                   ` Marko Rauhamaa
2014-09-05 20:44           ` Marko Rauhamaa
2014-09-05 21:08             ` Panicz Maciej Godek
2014-09-05 22:14               ` Marko Rauhamaa
2014-09-06  8:53                 ` Panicz Maciej Godek
2014-09-06 10:44                   ` Taylan Ulrich Bayirli/Kammer
2014-09-06 11:27                   ` Marko Rauhamaa
2014-09-06 11:54                     ` Taylan Ulrich Bayirli/Kammer
2014-09-06 23:46                     ` Panicz Maciej Godek
2014-09-07  0:20                       ` Marko Rauhamaa
2014-09-07 12:57                         ` Taylan Ulrich Bayirli/Kammer
2014-09-07 13:58                           ` Marko Rauhamaa
2014-09-07 16:46                             ` Taylan Ulrich Bayirli/Kammer
2014-09-07 19:49                               ` Marko Rauhamaa
2014-09-07 23:13                                 ` Taylan Ulrich Bayirli/Kammer
     [not found]           ` <CAPjoZoc7X7s+keog6avP62yvgJyQ3Ma_jomhw6xQq_rK9jnhVw@mail.gmail.com>
2014-09-06 16:57             ` Nala Ginrut

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=87vbp1q1u7.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me \
    --to=dthompson2@worcester.edu \
    --cc=carlosjosepita@gmail.com \
    --cc=godek.maciek@gmail.com \
    --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).