I don't think we have that same effect in software but I think there is an related one: when you don't have the protection of a static type system, you may become more careful.
I don't think we have that same effect in software but I think there is an related one: when you don't have the protection of a static type system, you may become more careful.
It's an interesting theory. On the other hand, the amount of time and money lost to null pointer bugs over the years suggests that we still aren't careful enough.
You could use that reasoning to argue we should be writing in assembly. I want all the automated checks I can get to get as close to bug free as possible. If you have to be careful about everything, you're going to exhaust yourself and miss even more bugs. It's much better when bugs are limited to smaller areas and you know where to be extra careful.
Having to be careful because there's no type system checking your work is a useful skill to learn in some contexts, but I think the current state of the software industry is a pretty good argument that human programmers will never be careful enough. So, we should do what we can to accommodate human fallibility and use machines to check our work early and often.
A static type system also requires continuous attention. The question is, does it free attention faster than it consumes it?
I'm not sure what you mean by this, or how it constitutes an increase over the demands of a runtime or weak type system.
> how it constitutes an increase over the demands of a runtime or weak type system
It's the difference between "I understand X", and "I have to figure out how to describe X in my language". And the difference between "my understanding changed", and "I have to figure out all of the places in my program where I need to update the code because of my new understanding".
I would not call that "continuous attention", because most of the time you're simply writing down a decision you've already made, and would have had to make even in a dynamic language.
In contrast, I think "continuous attention" is having to remember the current kinds of data being held in different variables in a long data-flow.
> And if your needs for that variable or class or function change, you need to explain to the compiler the differences.
Yes, but that's because the compiler is remembering your "checklist" for you. In a dynamic language you'd need to make all the same decisions, but you'd have to waste more brainpower (or introduce more bugs) by trying to manage it all yourself.
I'll be honest, I've never wasted much brainpower trying to remember the difference between covariant and contravariant, or whether I want Try[Future[String]] or Future[Try[String]], or anything like that, when working in a dynamic language. You just don't do shit like that.
Part of my job is maintaining a PHP/JS codebase that's 10+ years old, and I wish I had days where it was all about covariance, rather than the stupid stuff.