unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Mikael Djurfeldt <mikael@djurfeldt.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: guile 3 update, halloween edition
Date: Thu, 31 Oct 2019 17:13:52 +0100	[thread overview]
Message-ID: <87ftj8j3jz.fsf@pobox.com> (raw)
In-Reply-To: <CAA2XvwJAERXFeAGc8S5ufWRR0z+ujpGvw0JDA94bL_0k_fyu-w@mail.gmail.com> (Mikael Djurfeldt's message of "Thu, 31 Oct 2019 15:17:31 +0100")

Hey :)

On Thu 31 Oct 2019 15:17, Mikael Djurfeldt <mikael@djurfeldt.com> writes:

> How does the record subtyping relate to GOOPS? I do realize that there
> are issues related to keeping bootstrapping lean, but shouldn't record
> types and classes share mechanisms?

They share the struct layer.

Records are simple: their fields are laid out in order, are all unboxed,
and can be treated as a simple kind of nominal product type.  `match'
takes advantage of this.

GOOPS is more flexible: it can have different slot allocations, unboxed
slots, multiple inheritance, and so on.  Because of multiple inheritance
its accessors have to do dynamic dispatch; whereas for records, if
supertype A allocates slot X to index I, all subtypes will have that
slot in the same place.  A check whether a record is an instance of A is
a simple O(1) check, rather than the CPL search of GOOPS.

Exceptions have a kind of multiple inheritance, but it's more about
object composition than typing.  You can make a compound condition from
a heterogeneous collection of other conditions.  While you could
implement compound conditions with subtyping, it's more straightforward
to use composition.

I think the current status is close to the sweet spot but your thoughts
are welcome :)  I would dearly like to be able to subtype records in
GOOPS, but having looked at it a few times I haven't found quite the
right way to do it.

Cheers,

Andy



  reply	other threads:[~2019-10-31 16:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30 20:13 guile 3 update, halloween edition Andy Wingo
2019-10-30 21:19 ` Christopher Lemmer Webber
2019-10-31  0:01 ` Chris Vine
2019-10-31 16:20   ` Andy Wingo
2019-10-31 17:27     ` Chris Vine
2019-10-31  1:31 ` Nala Ginrut
2019-10-31  1:47 ` Thompson, David
2019-10-31 14:17 ` Mikael Djurfeldt
2019-10-31 16:13   ` Andy Wingo [this message]
2019-10-31 14:46 ` David Pirotte
2019-10-31 16:44 ` Sjoerd van Leent
2019-11-02  5:20 ` Mark H Weaver
2019-11-02 19:33   ` Mark H Weaver
2019-11-03 19:16   ` Andy Wingo
2019-11-03 20:18     ` Mark H Weaver
2019-11-15  9:03 ` Ludovic Courtès
2019-11-15 10:23   ` Andy Wingo
2019-11-16 15:26     ` Ludovic Courtès
2019-11-17 19:33       ` Andy Wingo

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=87ftj8j3jz.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=mikael@djurfeldt.com \
    /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).