]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
keyval: Document issues with 'any' and alternate types
authorMarkus Armbruster <armbru@redhat.com>
Mon, 20 Mar 2017 12:55:47 +0000 (13:55 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Tue, 21 Mar 2017 09:42:09 +0000 (10:42 +0100)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1490014548-15083-5-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
util/keyval.c

index 46cd540c5a9bc22368f8a42c6753f4cc340843ea..93d5db6b590427e412dfb172f1c406d6dd8958c1 100644 (file)
  * "key absent" already means "optional object/array absent", which
  * isn't the same as "empty object/array present".
  *
+ * Design flaw: scalar values can only be strings; there is no way to
+ * denote numbers, true, false or null.  The special QObject input
+ * visitor returned by qobject_input_visitor_new_keyval() mostly hides
+ * this by automatically converting strings to the type the visitor
+ * expects.  Breaks down for alternate types and type 'any', where the
+ * visitor's expectation isn't clear.  Code visiting such types needs
+ * to do the conversion itself, but only when using this keyval
+ * visitor.  Awkward.  Alternate types without a string member don't
+ * work at all.
+ *
  * Additional syntax for use with an implied key:
  *
  *   key-vals-ik  = val-no-key [ ',' key-vals ]