3 ms·
It means that every time you define a function, or declare a variable, or build a class, you need to explain to the compiler what exactly it is. And if your ne
by mcphage 9y ago
It means that every time you define a function, or declare a variable, or build a class, you need to explain to the compiler what exactly it is. And if your needs for that variable or class or function change, you need to explain to the compiler the differences. Some languages make it easy to explain to the compiler what's going on, some make it very difficult.
> 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".
- Terr_ 9y ago> you need to explain to the compiler what exactly it is 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.
- mcphage 9y ago> 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.
- Terr_ 9y agoYeah, but that's because all the wasted-brainpower goes into preventing even dumber errors, like a method that can't quite decide whether a variable is a string or an object or an array. 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.