Andre Poenitz wrote: > Why do we need the dispatch mechanism for calls into the kernel?
It is not needed, but it simplifies the code. For example, take the label dialog: Renaming a label is more than just changing some inset parameter, because some references might be changed, and some global lists need to be updated. Of course you could define a kernel API function that the label dialog needs to call when it is finished. But why would you want to do that if exactly the needed functionality is already available through the dispatch mechanism? Then the dialog simply fires the lfun and does not need to know at all what that triggers, and the logic for changing labels is kept in one place. Or take the proper enabling/disabling of the OK button. I solved this problem centrally by reusing getStatus(), which is part of the dispatch mechanism. Do you want to implement this logic in each dialog individually? > The lyxserver is used only for a few very specific functions. We can > have a separate entrypoint for them. But why would you want a second entry point? Until now I see only theoretical advantages of not using the dispatch mechanism ("it is the same app so it ought to use a direct API and not some string stuff"). Remember that we assume a serialization that does not cost any implementation effort. Speed is not an issue either since we are talking about stuff that depends on user interaction. > Even if there was a three line solution for that problem (and there is > actually, Q_DECLARE_METATYPE + QVariant::fromValue + QVariant::value) > it's probably nothing I'd suggest to use as "direct access" to the > kernel does not sound wrong. It is certainly not wrong, but it results in code that is more error prone, because you need to maintain a second interface and/or repeat some logic in the dialogs. > Reality check: How do you access libc functions? By serializing calls > to dup2 or fork? Nah... Come on, I am not proposing to serialize pixels for drawing. There is nothing wrong with direct access for this kind of stuff. I am talking about communication between dialogs and the kernel. How often do you use libc functions as a backend to some dialog that gathers the function parameters from users? Georg