3 ms·
> but you'll gain the extra power that comes with dynamic types What "extra power" are we talking about here? If we're talking about the power to pretend a bo
by mightybyte 13y ago
> but you'll gain the extra power that comes with dynamic types
What "extra power" are we talking about here? If we're talking about the power to pretend a bool is a string or vice versa, then no thanks, I'll pass. I suspect that a number of the things you are referring to that give you "extra power" are actually things that don't have anything to do with the type system like first class functions, tuples, etc. Static languages can have those things too, you know.
- awj 13y ago> If we're talking about the power to pretend a bool is a string or vice versa, then no thanks That's weak typing. JavaScript does this, Python and Ruby don't. Typically when people bring up the power of dynamic languages it's in the ability to alter definitions. The ability to extend existing classes/objects is pretty powerful, and isn't always trivially duplicated in static languages. Many concepts that can be painful in statically typed languages (creating/programming against new interfaces to existing types, reflection, delegation, etc) are easy as breathing with dynamic types. It's not a matter of can vs. can't so much as easy vs hard.
- mightybyte 13y agoOh right, my mistake. s/pretend a bool is a string or vice versa/not know whether an object even has a certain method because it isn't added until runtime/ I'll grant you that this type of thing is more difficult in static languages. But in my experience, the need for this kind of dynamic behavior is quite rare in terms of lines of code. So I'll trade it away any day of the week for the ability to reason about my code with more guarantees. At their core, all bugs are situations where the programmer's expectations didn't match reality. In my experience programmers who are good at debugging are good at being able to question as much of what could be going wrong as possible. Strong static types are about reducing the amount of things we have to question.