On 20/07/21 17:54, Markus Armbruster wrote:
First, let me describe what's wrong in my own words, because that's how
I understand stuff.

[snip]

All correct.

Next, the solution.  I get the idea of a wrapper visitor which gives you
"pflash0" when you ask for "drive", but oh boy do I wish we could fix
the bug with a lot less code.

Yeah, if QOM didn't use visitors and just went with QObject as the argument to getters/setters, all this wouldn't be needed.

That said, 1/3rd of this patch is tests, and visitors do have a hidden advantage: they give type checking for free. So all in all I'm not sure it would be better, especially now that we're starting to get more benefit from them (e.g. with compound properties replacing special-purpose command line parsing code).

Paolo


Reply via email to