Subject: Re: [boost] [review] Review of Outcome (starts Fri-19-May)
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2017-05-15 23:18:19
On 16/05/2017 03:48, Niall Douglas wrote:
> Are you referring to .get() and .value()?
> I use a convention of .value() in my own code to indicate when I am
> retrieving the value, and .get() to indicate I am throwing away the
> fetched value but I do want any default actions to occur e.g. if not
> valued, throw an exception. So .get() means "fetch and throw any error
> state if present".
> If people like this convention, I can make it formal by tagging
> .value()'s return with [[nodiscard]] and have .get() return void. If
> people dislike this convention, .get() can be removed.
> I really wasn't sure what people might prefer. [[nodiscard]] is so new
> it's hard to decide on if we are using it overkill or not. I look
> forward to any feedback.
Maybe I'm missing some context, but unless T is void, making a void
get() method seems very peculiar to me. Logically a get method should
actually get something.
(void get() where T is void is also weird, but at least its behaviour is
familiar to anyone used to futures, and is reasonably orthogonal to the
non-void T case, and has some benefits to *some* generic code -- though
sadly void is still a second-class citizen in the type system.)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk