unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: tomas@tuxteam.de
To: Christopher Allan Webber <cwebber@dustycloud.org>
Cc: guile-user@gnu.org
Subject: Re: GOOPS functional setter
Date: Sun, 15 Jan 2017 10:31:11 +0100	[thread overview]
Message-ID: <20170115093111.GA19468@tuxteam.de> (raw)
In-Reply-To: <87shole411.fsf@dustycloud.org>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Jan 14, 2017 at 03:16:10PM -0600, Christopher Allan Webber wrote:
> tomas@tuxteam.de writes:
> 
> > Curiously, Jan (also in this thread) came up with "clone",
> > independently.
> 
> Yes you're right. :)
> 
> Speaking of Jan and I both thinking about clone'ish things [...]

> Here's what it looks like in practice, adapting from the
> (srfi srfi-9 gnu) code:
> 
>   (define fsf-address
>     (make <address>
>       #:street "Franklin Street"
>       #:city "Boston"
>       #:country "USA"))
> 
>   (define rms
>     (make <person>
>       #:age 30
>       #:email "rms@gnu.org"
>       #:address fsf-address))
> 
>   (define new-rms
>     (clone rms
>            ((.age) 60)
>            ((.address .street) "Temple Place")))
> 
>   scheme@(guile-user)> (.age rms)
>   $12 = 30
>   scheme@(guile-user)> (.age new-rms)
>   $13 = 60
>   scheme@(guile-user)> (.street (.address rms))
>   $14 = "Franklin Street"
>   scheme@(guile-user)> (.street (.address new-rms))
>   $15 = "Temple Place"
> 
> ... not bad, eh?

You folks rock, seriously :-)

> Updated copy of goops-functional-setter.scm attached!  What do other
> people think?  Should I try to get this upstream in Guile?

I'd love that kind of interface. Feels pretty natural.

regards
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlh7QV8ACgkQBcgs9XrR2kbd5wCfVghdRDiJG5/AfrQ0kWkkNBzC
aZIAn3SFxYRIe4C5pG5LpEzsG2dunJgf
=i7FL
-----END PGP SIGNATURE-----



  reply	other threads:[~2017-01-15  9:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-13 19:09 GOOPS functional setter Christopher Allan Webber
2017-01-13 20:56 ` tomas
2017-01-14  2:11   ` Christopher Allan Webber
2017-01-14 10:08     ` tomas
2017-01-14 17:25       ` Arne Babenhauserheide
2017-01-14 21:16       ` Christopher Allan Webber
2017-01-15  9:31         ` tomas [this message]
2017-01-13 21:33 ` Jan Nieuwenhuizen

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=20170115093111.GA19468@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=cwebber@dustycloud.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).