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: Sat, 14 Jan 2017 11:08:39 +0100	[thread overview]
Message-ID: <20170114100839.GA3366@tuxteam.de> (raw)
In-Reply-To: <87vatie6gf.fsf@dustycloud.org>

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

On Fri, Jan 13, 2017 at 08:11:28PM -0600, Christopher Allan Webber wrote:
> tomas@tuxteam.de writes:

[fset vs clone]

> I think cloning isn't as clear; what we want is something that's the
> same as the previous instance of the object, but with one field changed.
> Clone makes it sound the same, but the goal is change without affecting
> the original.  It's attempting to be the same as slot-set! but
> functional, hence slot-fset.  Again, inspired by set-field and
> set-fields from (srfi srfi-9 gnu).

Yes, and after having read your post I understood where you came from.
The naming wouldn't have been discovrable for me right off.

Curiously, Jan (also in this thread) came up with "clone",
independently.

Now I'm not trying to imply that "clone" is "more right"; actually
I believe that there are two "modes" at work here. Let me speculate
a bit:

Perhaps from the more "strictly functional" point of view, the clone
operation is less important, because, whether the thing is cloned
behind the scenes or things are arranged by deep compiler magic and
the clone doesn't happen after all is none of our business. Not the
cloning is important, but the changed fields. In this world, the
mutating counterpart (set) doesn't even exists. Clone wouldn't be
an appropriate name here.

- From the more "naive", "imperative" point of view, it's the clone
operation what keeps us awake: allocating memory and things. Here
"clone" is the right word, it seems.

Perhaps what irritates me most is that "fset" is named  after
an imperative operation (set) and lives in a functional world.
Or something.

> However, I'm open to another name, if someone has something better...

At the end it's not that important: you made the function, you name
it :)

If my questions elicit some resonance in you, then they might be
useful.

> (Also, it would even be nicer if it were possible to make the new
> instance without copying every field manually as I did here.  It would
> be interesting if there were a metaclass that was smarter about slot
> allocation and used some functional structure so that we didn't need to
> iterate through every field just to change the one slot.  I'm not sure
> how hard that would be to do, or if it would be of significant benefit
> in the end.)

That's the more important part: the *interface* makes those things
possible in the first place (whether by a more efficient clone
primitive, as you envision, or by a clever compiler or both). Thus
a Good Thing, regardless of its name :)

thanks
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlh5+KcACgkQBcgs9XrR2kaDDACcDLOi8W1gS9TZ0oU4w1bxswAU
OgUAn0HAN1krKDEhJads7v9nIrq7mXRg
=7b9N
-----END PGP SIGNATURE-----



  reply	other threads:[~2017-01-14 10:08 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 [this message]
2017-01-14 17:25       ` Arne Babenhauserheide
2017-01-14 21:16       ` Christopher Allan Webber
2017-01-15  9:31         ` tomas
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=20170114100839.GA3366@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).