this whole thread has me like *distressed crab noises*https://twitter.com/moxie/status/1256640034054135808 …
-
Show this thread
-
alexander payne Retweeted Moxie Marlinspike
Rust gets away with so permissive a type-inference engine at binding sites precisely because it doesn't have this problem. all functions are fully specified in their signature, and since symbols in a scope can't collide, it's trivial to find the decl sitehttps://twitter.com/moxie/status/1256640035576623105 …
alexander payne added,
Moxie MarlinspikeVerified account @moxieLanguages designed for "writability" have function signatures that require you to press very few keys on the keyboard: "def foo(bar):" It's nice to press so few keys to write it, but error prone for the thousands of times people have to read/modify it.Show this thread3 replies 0 retweets 14 likesShow this thread -
Replying to @myrrlyn
Not to mention your tools can show you the inferred type at any point if you feel you need to see it. It's not like type inference is the same thing as dynamically typed. The information is still there, and can be exposed if you need it.
1 reply 0 retweets 3 likes -
That does assume the tools can do this. Even Rust (which has the stated benefits) has trouble often, and I've never seen, say, a code review platform with this capability for any language.
2 replies 0 retweets 2 likes -
rust-analyzer definitely does do this (which is admittedly a young technology). But this whole argument also assumes that the type of a variable is always (or even often) a useful thing to see, which I don't believe is the case.
2 replies 0 retweets 2 likes -
If we assume it *is* for a second, the tradeoff here is "I need tooling to expose the type at the point where a variable is assigned" vs "I need tooling to help me change every call site if I change the return type of this function".
1 reply 0 retweets 1 like -
The capabilities of something are typically much more important than the concrete type. Hell often the type is either unnameable or unreasonably difficult to name. Features like async/await are making this even more common.
1 reply 0 retweets 1 like -
For code review -- why is the variable declaration site the place that we should force a type to be explicitly declared? It's just as likely for me to review a PR that adds `http://foo.do _thingy()`, why not force UFCS here for clarity?
1 reply 0 retweets 1 like -
My point wasn't so much that variables need to be declared at the point of use (I did say I didn't really agree with moxie here), but more that relying on tooling to solve these problems ignores the large class of situations where such tooling does not and likely never will exist
1 reply 0 retweets 1 like
I definitely agree with you that we shouldn't rely too hard on tooling here. But ultimately tooling is a shortcut for looking up the definition of the method definition -- tools like ctags aren't exactly new. Macros will always make this be unsolvable in the general case
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.