Async-await footgun pointed out to me last night by @bassjacob: Always `return await` or if you wrap with try-catch it won't be caughtpic.twitter.com/uwOvrnRKM0
You can add location information to your Tweets, such as your city or precise location, from the web and via third-party applications. You always have the option to delete your Tweet location history. Learn more
I think this only makes sense to me b/c I have students build a sync/await with a generator function. Easier to spot the yield vs return. 1/
Once you hide all that ugly stuff, it’s easy to get lost again. 2/2
I'm not claiming it's not a gotcha, but rather that it's intrinsic to the tradeoff that lets us have "sequential but not sync" w/o types
but I think good linters (and type systems like TS) could help catch these kinds of bugs and should.
One of the things I appreciate about @reasonml is the ability to insist a function deals with promises "correctly".
fwiw rust has a similar facility (via must_use types and a high fidelity lint) that I think TSLint should integrate.
that sounds really cool, though compiler > linter imo. keep meaning to find time to learn rust. wasm might be the final straw. or rocket.rs
Rust lints passes are often part of the compiler. The difference is that there's a way to disable lints.
Ah. Yeah that makes sense. I missed that throws was an async function, I thought it was a plain function at first glance.
It's definitely a gotcha, but it's fallout of the sync/async split. Rust has a linter rule for this kind of case.
TLDR you can annotate a type as must_use and the linter will yell at you unless it gets assigned to a sink (or assigned to _)
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.