June 13, 2019
On 2019-06-12 17:58, FeepingCreature wrote:
> On Wednesday, 12 June 2019 at 11:56:57 UTC, aliak wrote:
>> These algorithms are already there if it's implemented as a range. There's no need to reimplement them.
> 
> For instance, `orElse` is the very clear and understandable `5.optional.chain(7.only).front`.
> 
> Which, if you are at all interested in readability, you'll `alias orElse = (a, b) => a.chain(b.only).front;` anyways. At which point you might as well `alias orElse = (a, b) a.present ? a.value : b;`

As I mentioned in the PR, I expect a "orElse" function to be available.

-- 
/Jacob Carlborg
1 2 3
Next ›   Last »