Re: [PATCH 11/19] rust/qobject: add from/to JSON bindings for QObject

Paolo Bonzini <[email protected]>
Newsgroups org.nongnu.qemu-rust,org.nongnu.qemu-devel
Message-ID <[email protected]>
On 12/8/25 10:17, Markus Armbruster wrote:
> Paolo Bonzini <[email protected]> writes:
> 
>> Il ven 5 dic 2025, 13:16 Markus Armbruster <[email protected]> ha scritto:
>>
>>>> Note however that there is no support for push parsing, therefore this
>>>> would not replace the balanced-parentheses machinery in
>>>> qobject/json-streamer.c, and therefore QMP would still need a minimal
>>>> lexer.
>>>
>>> That push parser...  I never liked it.  First, it's half-assed: it's a
>>> push lexer wed to a pull parser with parenthesis counting.  Second, why
>>> complicated & half-assed when you can do simple & quarter-assed instead?
>>> We could've required "exactly one complete JSON value per line", or some
>>> expression separator such as an empty line.
>>
>> Hmm not sure I agree, actually I think I disagree. It seems simpler but it
>> is also different.
> 
> Management applications would be just fine with the different interface.
> 
> Human users would be better off.  As is, a missing right parenthesis is
> met with silence.  You can then input whatever you want, and get more
> silence until you somehow close the last parenthesis.  Quite confusing
> unless you already know.
Not being able to add line breaks to a long JSON command (preparing it 
in an editor and pasting it into either a "-qmp stdio" terminal or 
socat/nc) would be a dealbreaker for me.

JSON says whitespace is irrelevant.  "This standard format but..." is a 
bad idea that requires extraordinary justification.  Not that it matters 
now 15 years down the line. :)

Paolo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.