News for hackers. Stuff that matters.
Re:Go 1.18 by LAC-Tech on Tuesday March 15, 2022 @06:41PM (#30692898)
What's do notation?

I've used optionals in many languages, and this is the first I've heard of it. What else do you really need except map and... flatMap (aka `then` aka `and_then` aka `>>=` aka `bind`).

Re:Go 1.18 by uryga on Tuesday March 15, 2022 @07:32PM (#30693349)
https://en.m.wikibooks.org/wiki/Haskell/do_notation

rough analogy: `await` replaces `.then()`, do-notation replaces `.flatMap()`

Re:Go 1.18 by int_19h on Tuesday March 15, 2022 @10:08PM (#30694451)
C# has had Nullable<T> for many years before it got stuff like ?. and ?? that mostly covers this, and it was, well, tolerable.
Re:Go 1.18 by BoorishBears on Tuesday March 15, 2022 @11:58PM (#30695153)
Ergonomics sucked and a lot of people didn't use them (or even know they existed!) because ergonomics sucked
Re:Go 1.18 by int_19h on Wednesday March 16, 2022 @06:21AM (#30697090)
From my work experience at the time, it was used pretty heavily in new codebases.
Re:Go 1.18 by BoorishBears on Wednesday March 16, 2022 @12:00PM (#30700466)
I mean the fact that they've been around since 2.0 but you saw it used heavily in new codebases says a lot doesn't it?
Re:Go 1.18 by int_19h on Wednesday March 16, 2022 @07:55PM (#30705730)
You misunderstood - I saw them in codebases that were new back when .NET 2.0 was new.

To be more precise, it was when .NET 3.5 was new (2008). That brought a lot of visibility to Nullable<T> because it was featured prominently in LINQ. But ?. didn't come until C# 6 (2014). I was wrong about ??, though - that one was added along with Nullable itself.