News for hackers. Stuff that matters.
Re:Go 2 Draft Designs by munificent on Tuesday August 28, 2018 @03:20PM (#17861994)
> I do think the argument for the check keyword instead of a ? operator like in Rust is quite weak. Mainly because a big advantage of the ? operator (apart from the brevity) is that it can be used in method calling chains.

In Dart (as in a couple of other languages) we have an `await` keyword for asynchrony. It has the same problem you describe and it really is very painful. Code like this is not that uncommon:

    await (await (await foo).bar).baz);
It sucks. I really wish the language team had gone with something postfix. For error-handling, I wouldn't be surprised if chaining like this was even more common.
Re:Go 2 Draft Designs by reggieband on Tuesday August 28, 2018 @06:38PM (#17863566)
Maybe I'm crazy but I'd much prefer that as:

   const temp = await foo;
   const bar = await temp.bar;
   const baz = await bar.baz;
But then again it looks like in this example we are returning promises from getters on objects which is something I would avoid.
Re:Go 2 Draft Designs by munificent on Tuesday August 28, 2018 @07:14PM (#17863756)
Yeah, the guidance is usually to hoist the subexpressions out to variables like you do here. But I encounter it often enough that it feels like we are trying to paper over a poor language syntax.

> we are returning promises from getters on objects which is something I would avoid.

Getters are very common in Dart and it's idiomatic to use them even for properties that are asynchronous. (It's not like making it a method with an extra `()` really solves anything.) It's not as common to have nested chains of asynchronous properties, but they do happen, especially in tests.

Re:Go 2 Draft Designs by skybrian on Tuesday August 28, 2018 @04:45PM (#17862715)
Would it be better to use statements more? After all, this is a sequence of steps and it's doing a context switch between each step. That seems better written vertically, one per line.
Re:Go 2 Draft Designs by btilly on Tuesday August 28, 2018 @07:55PM (#17863985)
Deeply chained method calls are a code smell on their own. But would it really be that much better if you wrote it as something like:

    foo..bar..baz;
Re:Go 2 Draft Designs by dom96 on Tuesday August 28, 2018 @05:47PM (#17863206)
I'm not sure about Dart, but in my experience it's rare that you await a function which returns an object with another awaitable in it.

Never mind something that nests these 2 levels deep.

Re:Go 2 Draft Designs by RodericDay on Tuesday August 28, 2018 @07:19PM (#17863797)
fetch() + response.text() is usually two. add a user-defined third and you're there.