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 -
Rust analyzer does it with... around 80% success for me. It often can't figure out the type. That will get better, of course, but I don't think it's trivial and IIUC there are some parts of it (macros) that make it unreasonably difficult -- those cases might never work well.
2 replies 0 retweets 1 like
And there are cases where naming the type just isn't possible or isn't helpful. And I don't think those cases are going to go away. My point is that if it's not clear what the capabilities of a variable are from the code, that's a failure of the code that was written
-
-
Forcing the name of the type to be written is almost never the best way to solve that problem
0 replies 0 retweets 0 likesThanks. Twitter will use this to make your timeline better. UndoUndo
-
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.