3 ms·
When it comes to code, I'm fairly certain "correctness" is in fact an irrefutable advantage. The argument has always been whether or not the price of that corr
by fastball 5y ago
When it comes to code, I'm fairly certain "correctness" is in fact an irrefutable advantage.
The argument has always been whether or not the price of that correctness is too high.
But at this point if you're using a modern IDE / code editor (e.g. VSCode), it's actually easier to write statically typed code because the inference / auto-completion / etc is so much better when you do.
At least with TypeScript in VSCode.
- DeathArrow 5y agoWith Visual Studio also. Intellisense works wonders.
- deleted 5y ago[deleted]
- dragonwriter 5y ago> The argument has always been whether or not the price of that correctness is too high. No. I mean, that's been part of the argument, but so has whether static typing actually gave you useful correctness. Many static languages have had type systems that are more designed around convenience of compilation (and performance of compiled code) than correctness; the type systems of the optional typecheckers of modern dynamic languages are leaps and bounds better than static type systems of most popular static languages a couple decades ago, and have been for some time. > But at this point if you're using a modern IDE / code editor (e.g. VSCode), it's actually easier to write statically typed code because the inference / auto-completion / etc is so much better when you do. If you have good inference, statically typed and dynamically typed code is virtually indistinguishable TypeProf-IDE for Ruby, discussed in TFA, generates type signatures by inference from plain Ruby code.
- eropple 5y agoStrong disagree with the idea that dynamic inference steps to static declarations, particularly for Ruby and especially if you're using anything that expects you to write code inside of its DSL. The inference tends to fall off and because it isn't expected of you, nobody's doing anything to help there. Maybe Rails is special-cased enough to get away with it, but I still maintain a project in Grape and none of the autocomplete solutions I have found for Ruby help significantly at all. Meanwhile over in TypeScript, I literally can't remember the last time I used `any` or `unknown` except at a module's edge during validation of untrusted input, and autocomplete is awesome.
- Mikeb85 5y ago> it's actually easier to write statically typed code because the inference / auto-completion / etc is so much better when you do. Ruby has a pretty nice language server, nice linter, REPL (Pry), many other tools. The best development experience IMO is still stuff like SLIME or Smalltalk environments. "Intellisence" just makes using statically typed languages bearable. It's not a unique feature.
- kaba0 5y agoIntellisense will allow you to do explorative programming, finding what method is callable on a given object. It’s much easier to look up n methods than to try to guess what is the whole state of the program where it may accept this and that, where even in the best case you might get a fraction of what a statically typed language’s autocompletion allows for. Like just seriously try intellij with java and pycharm for a php code.
- Mikeb85 5y agoRuby has (always had) a REPL and .methods gives you all possible methods you can call on an object. Editors with completion have been around forever too. "Intellisence" is just what MS calls it. It's not unique to statically typed languages. Completion has existed for dynamic languages probably longer than I've been alive. In fact, the reason tooling for Java/C# is so good is because the VM can feed it info as it's running, since even though the language is static the runtime is dynamic.
- kaba0 5y agoPlease try one out, the difference in quality is staggering. Also, .methods is a runtime thing, that’s hardly useful. Of course at runtime you must know the available methods.
- Mikeb85 5y agoI do write code in statically typed languages (C++, Haskell, have done Java before, etc...). > Also, .methods is a runtime thing, that’s hardly useful I think you missed the whole point of a REPL and dynamic languages... Developing while program is running = runtime things are definitely useful, they provide instant feedback (including completions, linting, that sort of thing).
- tambourine_man 5y agoThat’s why I used correctness in quotes, because it’s no guarantee.
- fastball 5y agoIt's not a guarantee, but an environment/language that yells at you when you try to pass a boolean to a function that should only ever accept a string is going to result in a more correct program than one that just... doesn't say anything and lets you happily do things that make zero sense.