476 karma · joined May 12, 2020 (6y ago) · 570 submissions
comment 3y ago · link · parent
See: "Work In Progress: an Empirical Study of Static Typing in Ruby; Daly, M; Sazawal, V; Foster, J."
See: "Haskell vs. Ada vs. C++ vs. Awk vs. ... An Experiment in Software Prototyping Productivity; Hudak, P; Jones, M."
Lisp - A dynamically typed language had the lowest development time by a factor of 2.5x. Seems to be the same figure I'm giving, fancy that!
"He also misses the biggest add of typing your code which is that other people can understand it better."
Nope.
See: "How Do API Documentation and Static Typing Affect API Usability? Endrikat, S.; Hanenberg, S.; Robbes, Romain; Stefik, A."
You need documentation and whilst Java students may study with dynamic typing since they haven't been taught it, it's pretty clear that on it's own static typing provides almost no useful documentation.
"This is often lost on junior programmers..." I'm far more experience than you, which is why I'm calling out the BS.
I think you will find that the research suggests that static typing and dynamic typing have a similar bug rate per line of code.
See: "A Large Scale Study of Programming Languages and Code Quality in Github; Ray, B; Posnett, D; Filkov, V; Devanbu, P"
Once you combine that knowledge with the knowledge that dynamically typed programs have less lines per feature.
Relational Lisp 274 compared to Ada 767 or C++ 1105.
Dynamic typing wins out because the programs are smaller, making them faster to write and contain less bugs per software feature.
The link you posted confirms it.
Do you understand that you are wrong?
comment 3y ago · link · parent
But if it can't catch 60% of all errors and it can't. Then it's worse than dynamic typing.
This isn't complicated. If you are excluding performance, then static typing is inferior to dynamic typing. It's that simple. No ifs, no buts.
I do write statically typed code but that's for performance critical code. Since I've got good experience of both, I understand the differences very well.
I assure you that using static typing in a scripting language like Python is a mindnumbingly stupid thing to do.
comment 3y ago · link · parent
It also says that a software feature only needs 1/2.5 lines if you are using dynamic typing.
That means dynamic typing reduces bugs by 2.5x compared to static typing per software feature.
comment 3y ago · link · parent
"What if you already know the majority of your bugs, as logged today, could be prevented by a type checker?"
You would be a very bad programmer, since the vast majority of bugs are logic bugs.
"why does C do static typing" Code performance. It needs them to effective map types to registers avaliable on the machine it's been compiled for.
Rust lifetimes are about getting C like performance without the bugs introduced by using the techniques required for C like performance. You could remove Rust lifetimes and get all the same safety, it's just the programs would run slower due to garbage collection.
"So then TypeScript. Let's assume " TypeScript is an obvious bad example since JavaScript is a very bad language since it was hacked together by browser makers over several decades. You could make a dynamic typed equivalent of TypeScript and it would have the same advantages.
"The argument for static type checking is strong" It's incredibily weak it prevents a class of bugs that only occur very rarely in dynamically typed languages (3%). By both increasing your development time by 2.5x and increasing the total number of bugs in your program by 2.5x.
You wanting to believe in static typing doesn't stop it sucking in the context of scripting languages.