Daniel P. Berrange wrote: > On Tue, Jan 26, 2010 at 12:57:54PM +0000, Jamie Lokier wrote: > > Luiz Capitulino wrote: > > > capability_enable [ "foo", "bar" ] > > > > > > Now, only one command is not terrible difficult, but we would > > > have to accept an array of objects, like: > > > > > > [ { "name": "foo", "enabled": true }, { "name": "bar", "enabled": true } ] > > > > That looks like XML-itis. > > > > Why not { "foo": true, "bar": true }? > > It depends on whether we think we're going to need to add more metadata > beyond just the enabled/disabled status. If we did want to add a further > item against foo & bar, then having the array of hashes makes that > extension easier becaue you add easily add more key/value pairs to > each.
Sure, extensibility is good, and I personally don't care which format/function are used. Just wanted to question the padded structure, because sometimes that style is done unintentially. Look at the argument leading up here - Luiz says let's use separate, non-extensible enable/disable commands taking a list, because if it were a single command it'd be important to make it extensible. Does that make sense? I don't understand that reasoning. On that topic: In the regular monitor, commands are often extensible because they take command-line-style options, and you can always add more options. What about QMP - are QMP commands all future-extensible with options in a similar way? -- Jamie (ps. XML-itis: a tendancy to write <element><name>tag</name><attribute><attr-name>name</attr-name><attr-value>value</attr-value></attribute></element>, when <tag name=value/> would do).