[Development] Make Qt6 JNI API safer to use

Simon Hausmann Simon.Hausmann at qt.io
Fri Mar 6 12:59:32 CET 2020


Hi,

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.


Simon
________________________________
From: Development <development-bounces at qt-project.org> on behalf of Thiago Macieira <thiago.macieira at intel.com>
Sent: Thursday, March 5, 2020 16:31
To: development at qt-project.org <development at qt-project.org>
Subject: Re: [Development] Make Qt6 JNI API safer to use

On Thursday, 5 March 2020 07:29:07 PST Bogdan Vatra via Development wrote:
> În ziua de joi, 5 martie 2020, la 17:21:11 EET, Thiago Macieira a scris:
> > On Thursday, 5 March 2020 07:14:44 PST Vitaly Fanaskov wrote:
> > > I think something like std::expected is a nice thing to have.
> > >
> > > There is some experimental implementation of std::expected:
> > > https://github.com/TartanLlama/expected.
> > >
> > > Another good example is Result
> > > (https://doc.rust-lang.org/std/result/index.html) type from Rust. But
> > > might look clumsy in C++, because there is neither pattern matching nor
> > > operator?
> > > (https://doc.rust-lang.org/std/result/index.html#the-question-mark-opera
> > > to
> > > r-> )  to handle this case gracefully.
> >
> > We have QSystemResult in QtCore already. This predates both std::expected
> > and Result from Rust.
> >
> > One of my abandoned commits (see the I/O thread) was an update to it to
> > make it better.
>
> Where is QSystemResult? I can't find it in dev branch ... Did you rename it?

Ah, sorry, we only have QSystemError. QSystemResult is the class I added and
abandoned in Idaa189413f404cffb1eafffd14cef83d45089eee.

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products



_______________________________________________
Development mailing list
Development at qt-project.org
https://lists.qt-project.org/listinfo/development
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20200306/d30e033e/attachment.html>


More information about the Development mailing list