Investigate where std::optional should be used
Open, Needs TriagePublic

Description

With C++17 we can use std::optional. This is particularly useful for places where we currently do stuff like boolean out parameters that indicate success/failure.

Investigate where those places are and port them

Related Objects

alex moved this task from Backlog to Metatasks on the KF6 board.May 22 2021, 1:50 PM

Just wanted to drop a word on it. I'm all in favor of Option, Result and other algebraic rusty types. But how is it going to integrate with QML runtime? JS can only meaningfully represent either external nullability or special type-specific internal 'invalid' state using regular methods like 'isValid()' etc. The whole language seem to revolve around the concept of external null/undefined values, which can be seen in the recently added Optional chaining (?.) operator. (idk if it's already there but) special support definitely can be added to the QML/JS engine so that it would convert std::optional back and forth between languages boundary, but of course that raises a usual question: what if Some(null) is a valid state that should be representable?