4 ms·
Because everything has a cost, and the cost of static typing, as it stands right now, is far higher than any hypothetical you can propose about more difficult r
by ubernostrum 9y ago
Because everything has a cost, and the cost of static typing, as it stands right now, is far higher than any hypothetical you can propose about more difficult refactoring or unsuitability for "large" codebases.
- tigershark 9y agoWhat is the "far higher" cost of static typing? In F# you don't even need to specify the types, they are (almost) all inferred. And you can be sure that you won't ever multiply feet with meters and crash some space probe on Mars for example. I think that the cost of the lost space probe is far higher than whatever advantage you find in dynamic typing. From my point of view I can see no advantage whatsoever, only disadvantages.
- Too 9y agoI'm also curious about this "cost of static typing" that is always brought up. What is the cost really? Typing and reading 5 extra characters per function argument?! It's not like every single line of your algorithm inner loop code will be littered with types, there you still keep it clean and skimmable with inferred types. You only make the interfaces type safe, this prevents function misuse, simplifies refactoring and makes the architecture graspable.
- ubernostrum 9y agoThe cost is up-front having to think carefully about types when you're not yet done exploring the problem space. Types, if you're going to use them, should be decided on after you've completed that step. This is why if you're going to do it, a dynamically-typed language that allows adding hints/annotations later on is an ideal choice. And this is not a purely hypothetical objection: once you put types in a program, you're constraining the future of what you can do unless/until you go back and change them. Those constraints are a very real and, in my experience, very high cost.
- seanwilson 9y agoYou say I'm being hypothetical but I back up what I'm saying with examples when you don't. What high cost do you mean? The extra time you spend writing type annotations and getting your program to compile is time you save puzzling through runtime errors. Python, JavaScript and even PHP all have ways to get static checking from the use of types. Why would you not want to take advantage of this and rely on less reliable dynamic checks instead?