From: Neil Jerram <neil@ossau.uklinux.net>
Cc: guile-user@gnu.org
Subject: Re: equivalent of "this" in goops?
Date: Wed, 16 Feb 2005 23:43:19 +0000 [thread overview]
Message-ID: <4213DA97.5000700@ossau.uklinux.net> (raw)
In-Reply-To: <87sm3wt877.fsf@ivanova.rotty.yi.org>
Andreas Rottmann wrote:
> Greg Troxel <gdt@ir.bbn.com> writes:
>
>>In a class representing a node, I want to have a slot with an
>>init-thunk, [...] So, I'd like to pass 'this' in c++ terms, and I don't see how to do
>>that from reading goops.info.
>
> FWICT (not being a GOOPS expert), this is not possible without
> extending GOOPS: the init-thunk of a slot is specified at class
> creation time, and the earliest time "this" is avaiable is in the
> "initialize" generic. However, since the init-thunk is called at
> initialization time, "this" would be available at the time it is run,
> but there is no way to pass it, since the init-thunk, is, well, a
> thunk ;). I could imagine a init-function (name to be argued), which
> gets passed all arguments from "initialize" could be a useful
> extension.
Absolutely right. Your best bet at this point is to customize the
initialize method for the class:
(define-method (initialize (this <node>) initargs)
(next-method)
(slot-set this 'name-of-slot-with-init-thunk
(init-function this)))
(It's probably also possible to use the MOP to support #:init-proc as a
new slot option, but that would require more thought.)
Regards,
Neil
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
next prev parent reply other threads:[~2005-02-16 23:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-16 21:35 equivalent of "this" in goops? Greg Troxel
2005-02-16 23:07 ` Andreas Rottmann
2005-02-16 23:43 ` Neil Jerram [this message]
2005-02-18 17:42 ` Greg Troxel
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=4213DA97.5000700@ossau.uklinux.net \
--to=neil@ossau.uklinux.net \
--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).