From: "Kjetil S. Matheussen" <k.s.matheussen@notam02.no>
To: guile-user@gnu.org
Subject: Re: the future of Guile
Date: Thu, 6 Dec 2007 15:52:58 +0100 (CET) [thread overview]
Message-ID: <Pine.LNX.4.64.0712061540170.9058@ttleush> (raw)
In-Reply-To: <cmu-lmtpd-27643-1196871540-1@mail-imap2.uio.no>
"Marco Maggi":
>> 3b. Death to structs! IMO they were "an attempt", but the
>> resulting code is awful (sorry, but can you disagree?).
>>
>> Err.. but aren't structs the main part of how GOOPS is
>> implemented?
>
> IMO Guile's structs do nothing that cannot be done better
> with a good old C struct wrapped by a SMOB.
I've mentioned this before, but In Snd there is a function to
automatically create C structs. You have to free
the underlying c object manually though, but adding a SMOB
wrapper around shouldn't be that hard.
Oh, and thats yet another "should" for HBGC:
You don't need to mess with SMOBs to garbage collect C
objects when using the HBGC.
(load "eval-c.scm")
(define-ec-struct <struct_name>
<int> one
<float-*> twos
<char-*> three
<SCM> scm)
(define test (<struct_name> :one 1
:twos '(2)
:three "three"))
(-> test one)
=> 1
(-> test one 90)
(-> test one)
=> 90
(-> test twos)
=> (2.0)
(-> test twos '(4 5 6))
(-> test twos)
=> (4.0 5.0 6.0)
(-> test three)
=> "three"
(-> test three "four")
(-> test three)
=> "four"
(-> test scm)
=> #f
(-> test scm (lambda (x) x)) ;; stored elsewhere too, so it won't be gc-ed.
(-> test scm)
=> #<procedure #f ((x) x)>
(-> test get-size)
=> 16
(-> test get-c-object)
=> ("A_POINTER" 147502592)
(-> test destructor) ;;free it
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
next parent reply other threads:[~2007-12-06 14:52 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cmu-lmtpd-27643-1196871540-1@mail-imap2.uio.no>
2007-12-06 14:52 ` Kjetil S. Matheussen [this message]
[not found] <cmu-lmtpd-4316-1197047238-3@mail-imap2.uio.no>
2007-12-07 17:42 ` the future of Guile Kjetil S. Matheussen
2007-12-07 6:28 Marco Maggi
-- strict thread matches above, loose matches on Subject: below --
2007-12-05 22:32 Marco Maggi
2007-12-05 22:56 ` Ludovic Courtès
2007-12-05 21:02 Marco Maggi
2007-12-05 15:40 Mike Gran
2007-12-05 16:05 ` Julian Graham
2007-12-05 16:18 ` Daniel Ridge
2007-12-05 20:41 ` Ludovic Courtès
2007-12-05 9:01 Marco Maggi
2007-12-05 14:19 ` Roland Orre
2007-12-05 20:28 ` Ludovic Courtès
[not found] <34.F3.20110.D6985574@avas19>
2007-12-04 19:54 ` the future of guile Daniel Llorens del Río
[not found] <cmu-lmtpd-7104-1196779864-1@mail-imap2.uio.no>
2007-12-04 18:08 ` the future of Guile Kjetil S. Matheussen
2007-12-04 18:34 ` Kjetil S. Matheussen
2007-12-04 20:06 ` Roland Orre
2007-12-04 20:42 ` Ludovic Courtès
2007-12-04 22:30 ` Kjetil S. Matheussen
[not found] <F8.1B.18780.B4965574@avas11>
2007-12-04 15:55 ` the future of guile Daniel Llorens del Río
2007-12-04 6:50 the future of Guile Marco Maggi
2007-12-04 8:48 ` Stephen Compall
2007-12-04 12:41 ` Ludovic Courtès
2007-12-04 14:50 ` Bill Schottstaedt
2007-12-04 15:30 ` Ludovic Courtès
2007-12-04 23:00 ` Neil Jerram
2007-12-05 23:11 ` Andy Wingo
2007-12-06 19:48 ` Mikael Djurfeldt
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=Pine.LNX.4.64.0712061540170.9058@ttleush \
--to=k.s.matheussen@notam02.no \
--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).