From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi8vz-00017t-1s for qemu-devel@nongnu.org; Fri, 02 Oct 2015 18:36:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zi8vu-0003Ff-B1 for qemu-devel@nongnu.org; Fri, 02 Oct 2015 18:36:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44849) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi8vu-0003FZ-5R for qemu-devel@nongnu.org; Fri, 02 Oct 2015 18:36:06 -0400 References: <1443760312-656-1-git-send-email-eblake@redhat.com> <1443760312-656-7-git-send-email-eblake@redhat.com> <871tddfvjx.fsf@blackfin.pond.sub.org> <560E9927.5060102@redhat.com> <87zj01nqua.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <560F06CF.3000007@redhat.com> Date: Fri, 2 Oct 2015 16:35:59 -0600 MIME-Version: 1.0 In-Reply-To: <87zj01nqua.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="n5Fbp1rfFf32HwTEasdvQeKP54aGFUghp" Subject: Re: [Qemu-devel] [PATCH v6 06/12] qapi: Track owner of each object member List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Michael Roth , marcandre.lureau@redhat.com, qemu-devel@nongnu.org, ehabkost@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --n5Fbp1rfFf32HwTEasdvQeKP54aGFUghp Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/02/2015 11:05 AM, Markus Armbruster wrote: >> Might be doable, but then we'd have to generate the implicit object na= me >> prior to creating its Member objects (thus splitting >> _make_implicit_object_type() into two parts). >=20 > def _make_implicit_object_type(self, name, role, members): > if not members: > return None > (1) name =3D ':obj-%s-%s' % (name, role) > if not self.lookup_entity(name, QAPISchemaObjectType): > (2) self._def_entity(QAPISchemaObjectType(name, None, None, > members, None)) > return name >=20 > We create the implicit object type name at (1), and we associate the > type and its members in (2), by creating references from type to > members. Isn't that the natural place for creating back-references, > too? Assuming we need them. Okay, I don't think we need a backref; a string name is good enough. And I like your idea of making the implicit object name something where the suffix is usable as-is. So I'm currently playing with: class QAPISchemaObjectTypeMember... def __init__... self.owner =3D None def check... assert self.owner class QAPISchemaObjectType... def __init__(..., members): for m in members: assert isinstance(m, QAPISchemaObjectTypeMember) assert not m.owner m.owner =3D self.name --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --n5Fbp1rfFf32HwTEasdvQeKP54aGFUghp Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWDwbQAAoJEKeha0olJ0NqljgH/RUpyXhsAQTWDrhJp5vnlK4b DUy4APox4w8/WyWt8p6heNyGf8n6PXHgtDnyMnN+J12JA0VUW31HvQPuBCzEQ4uO zm4Co81KMcfC0VokpTa7tmRHhwDODWhrbrNRHpR2L0ooI8rFsMdfvsJjwY4+9USy FDfRLZafCBw36iSmQoSDIH4KgIkQDi7ZunsqrVFOSK/Tj2Yu9YPt1FLQ20Kx4uSP n2qMpZv/oKbHsHedoi+V4tFgkmxIUYqRG2wocgBqoaHFlil9EXHpN63rQ15eXI3n jH0253Ywa+ZKqocQq64WE5c6lih9mZkGIqDIbzGyNcrxLno5Vuoj0cRFg99lRXk= =iuGv -----END PGP SIGNATURE----- --n5Fbp1rfFf32HwTEasdvQeKP54aGFUghp--