From: Mark H Weaver <mhw@netris.org>
To: Rob Browning <rlb@defaultvalue.org>
Cc: "Ludovic Courtès" <ludo@gnu.org>, guile-devel@gnu.org
Subject: Re: Unintentional conflict in define-immutable-type?
Date: Fri, 27 Nov 2015 16:21:49 -0500 [thread overview]
Message-ID: <87mvtzuoia.fsf@netris.org> (raw)
In-Reply-To: <87h9keeq9l.fsf@trouble.defaultvalue.org> (Rob Browning's message of "Sat, 21 Nov 2015 20:12:22 -0600")
Rob Browning <rlb@defaultvalue.org> writes:
> Mark H Weaver <mhw@netris.org> writes:
>
>> I believe you are mistaken about that. Looking at both the code and the
>> expansion of your 'define-immutable-record-type' form above, I see no
>> evidence that <foo> is bound to anything by it.
>
> I imagine it's actually goops that's doing it.
>
> Try using "define-immutable-type <foo>" and then add a (display
> <<foo>>).
I did, and I found that <<foo>> was unbound. However, I see now that if
GOOPS is loaded, <<foo>> does indeed become bound to a class. I find
this a bit unsettling to be honest, but I stand corrected. Thanks :)
> That's what prompted my original post, I thought it might be handy to be
> able to use define-immutable-type (and the other record definitions) to
> create "normal" goops class names.
>
> So that you can have:
>
> (define-immutable-type foo ...)
> (define-method (bar (x <foo>)) ...)
You can do this if you pick a different name for the constructor.
However, I agree that it would be nice to allow the class to be named
<foo> and the constructor to be named foo. The first idea that comes to
mind is to provide an optional extension to the 'define-record-type' and
'define-immutable-record-type' syntax to explicitly give the name of the
class. Then you could name the RTD something like :foo and still name
the class <foo>.
> instead of only supporting:
>
> (define-immutable-type <foo> ...)
> (define-method (bar (x <<foo>>)) ...)
>
> Of course you can always just:
>
> (define <foo> <<foo>>)
>
> afterward, but that's not quite right.
I guess that wouldn't work. After (define-immutable-type <foo> ...),
it's important that <foo> remain bound to the RTD in the module where
'define-immutable-type' was evaluated. The other procedures defined by
'define-immutable-type' refer to <foo> and rely on it being bound to the
RTD.
Mark
next prev parent reply other threads:[~2015-11-27 21:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-19 4:25 Unintentional conflict in define-immutable-type? Rob Browning
2015-11-19 20:32 ` Mark H Weaver
2015-11-22 2:12 ` Rob Browning
2015-11-27 21:21 ` Mark H Weaver [this message]
2015-11-27 21:33 ` Rob Browning
2015-11-19 20:40 ` Ludovic Courtès
2015-11-27 18:34 ` Rob Browning
2015-11-27 20:37 ` Ludovic Courtès
2015-11-27 21:24 ` Rob Browning
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=87mvtzuoia.fsf@netris.org \
--to=mhw@netris.org \
--cc=guile-devel@gnu.org \
--cc=ludo@gnu.org \
--cc=rlb@defaultvalue.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).