[Development] Make Qt6 JNI API safer to use
apoenitz at t-online.de
Fri Mar 6 20:03:09 CET 2020
On Fri, Mar 06, 2020 at 11:59:32AM +0000, Simon Hausmann wrote:
> I think it would be great to have a result type in the Qt API and use
> that, instead of C++ exceptions. In theory we could use std::variant,
> but I think the API inconvenient for the use-case of a result. That
> wouldn't prevent us from using it in the implementation though.
The problem with the currently available and sometimes sold as "proper"
solutions in C++ is that they require a lot of boilerplate to be written,
so people (rightfully...) ignore or even actively refuse to use them.
As stated earlier, Rust's Result and question mark operator is a *really*
nice solution to that. It's almost no overhead to write and read compared
to the "no error checking" solution.
Now, if there were only a way to change something in C++ ...
More information about the Development