im v excited to be able to do thispic.twitter.com/B0IsL1OUhO
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
Can you clarify? This is meant to be reeeeally close to how current JS destructuring works. The difference is some extra matching-related syntax. Guards exist exclusively at the toplevel.
I agree that deeply nested destructuring is a pain pretty much no matter what you do -- I think the utility of this is simplifying navigating 1- or 2-levels that often turn into `if` statements with stuff like `if (foo && http://foo.bar && foo.baz === 1)` etc
Yeah I think this example illustrates the one level use cases nicely. Would this syntax differentiate between undefined and missing? In other words, would a prop with undefined as a value match, while a missing prop wouldn't?
the short version: yes! Matcher keys mentioned makes their presence required (w/ .hasOwnProperty()). Primitive literals are (currently) matched `===`. Long version: I spent most of today writing up a rough implementaion + documenting a bunch of details:https://github.com/zkat/pattycake
I wonder if that could be a footgun with forwarded undefined (and inconsistent with defaults in destructuring: let { x: x = 1 } = { x: undefined } x // 1
Idk. I hadn't looked too closely at what current destructing does. If undefined is what default values actually check against, that seems a better solution. Would you care to PR that?
I'm heading to bed in a sec
No problem! I can at least open an issue, depending on how hard the current language is to modify. Link?
Up the thread! I'm gonna see about replacing the existing match proposal with this one once I've incorporated some missing bits for the original and the champions give their blessing. If it works out that way
https://github.com/zkat/pattycake
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.