qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, "Eduardo Habkost" <ehabkost@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>, "Lin Ma" <lma@suse.com>
Subject: Re: [Qemu-devel] [PATCH for-2.9 v2] qom: Make all interface types abstract
Date: Thu, 15 Dec 2016 14:45:34 +0100	[thread overview]
Message-ID: <66ac2973-03c3-a04a-bead-981314e63bbd@redhat.com> (raw)
In-Reply-To: <87oa0e8kt5.fsf@dusky.pond.sub.org>



On 14/12/2016 18:47, Markus Armbruster wrote:
> Paolo Bonzini <pbonzini@redhat.com> writes:
> 
>> On 14/12/2016 14:48, Eduardo Habkost wrote:
>>>> How do you find all abstract TypeInfo in the source?  The uninitiated
>>>> might grep for .abstract = true, and be misled.  The initiated will be
>>>> annoyed instead, because grepping for *absence* of .instance_size = is
>>>> bothersome.
>>>>
>>>> I suspect life could be easier going forward if we instead required
>>>> .abstract = true for interfaces, and enforced it with
>>>> assert(ti->instance_size || ti->abstract) here.
>>> I was doing that before deciding to change type_initialize(). I
>>> think I still have the commit in my git reflog, I will recover it
>>> and submit it as v3.
>>
>> I think it's worse.
>>
>> Interfaces are abstract by definition.  Requiring ".abstract = true"
>> makes things less intuitive.  v2 seems good.
> 
> What makes a TypeInfo declaration an interface?  Whatever it is, it
> better be *locally* obvious.

The fact that the superclass is an interface:

1) most interface names are (or should be) "interfacey".  Compare
device, memory backend, console (all classes) with user-creatable, fw
path provider, hotplug handler.  A few others simply end with "_IF".  Of
course naming is the hardest problem in computer science so there are
some interfaces whose name might apply just as well to a class (stream
slave, ISA DMA).  However...

2) ... currently we don't have a single case of an interface that
doesn't inherit from TYPE_INTERFACE, so all interfaces are declared with
".parent = TYPE_INTERFACE".  That does make a TypeInfo obviously an
interface.

If we ever have a case of interface inheritance, the supertype had
better have a good name.

Paolo

  reply	other threads:[~2016-12-15 13:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-12 18:31 [Qemu-devel] [PATCH for-2.9 v2] qom: Make all interface types abstract Eduardo Habkost
2016-12-14 13:04 ` Markus Armbruster
2016-12-14 13:48   ` Eduardo Habkost
2016-12-14 17:07     ` Paolo Bonzini
2016-12-14 17:45       ` Eduardo Habkost
2016-12-14 17:47       ` Markus Armbruster
2016-12-15 13:45         ` Paolo Bonzini [this message]
2016-12-19 10:21           ` Markus Armbruster

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=66ac2973-03c3-a04a-bead-981314e63bbd@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=armbru@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=lma@suse.com \
    --cc=qemu-devel@nongnu.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 NNTP newsgroup(s).