6 ms·
It's frustrating that this static vs dynamic 'battle' still goes on. The longer everyone thinks this is actually a problem, the longer we have to wait for innov
by hacker_9 10y ago
It's frustrating that this static vs dynamic 'battle' still goes on. The longer everyone thinks this is actually a problem, the longer we have to wait for innovations to happen. Look at the web in 2016, the technology is a complete disarray. Look at the game industry in 2016, where C++ is thrown around as the the cause and solution to all life's problems. A language created 33 years ago now with no intention of being used as it is today.
The advantage of static typing is obvious to me; the more my computer understands of my code, the less work I have to do. I can offload my memory and instead think about things that are more interesting, not be looking up Python obscurities on Stackoverflow.
But static typing is not perfect, and there is still more the computer could be doing if it had more understanding. That is where we should be focusing, that is where the real problem is.
- sesm 10y agoWith static typing the computer doesn't "understand" your code. It just automatically checks the correctness proof you've presented to it. And the correctness is limited only to certain properties of the program, that a given type system supports.
- hacker_9 10y agoWe can argue about the definition of 'understand' all day, but it's a simple fact that the computer has more of an understanding of the structure of your program with a type system, and thus can help out more.
- bb88 10y agoI still wouldn't use 'understanding' in that context. It makes as if a static typing compiler sounds "magical". I could say "python is better at understanding what the programmer wants to do". But I think you'd disagree with me. The compiler is doing lexical analysis of the program being fed into it. That's it.
- dwc 10y ago> And the correctness is limited only to certain properties of the program, that a given type system supports. In case there are readers not familiar with the current state of things, you can pick solid languages today whose type systems support a LOT. It is completely fair (and good) to point out that this isn't a panacea, but it can significantly help.
- marcosdumay 10y agoIf you really think types are only useful for verifying code correctness, you probably never used a language with a modern type system.
- goatlover 10y agoRegarding your last sentence, part of Alan Kay's motivation for OOP with SmallTalk was that he filt that type systems were limiting because they never anticipate all the possible types a program will need.
- crdoconnor 10y ago>The advantage of static typing is obvious to me; the more my computer understands of my code, the less work I have to do. There's nothing about dynamic typing which precludes this. There are also things which it is not necessary for your computer to understand but the rigidities of an excessively strict type system will demand it be told those things anyway.
- triMichael 10y agoI've dealt with dynamic typing vs static typing A LOT recently. In my experience static typing has a major complication that most programmers don't think about: datastructures. When you are dealing with a list in Python for example, you just throw whatever you are working with into that list. Whereas Java Generics and C++ Templates are very ugly because you can't just say "this is a list of stuff" you have to say "this is a list of a set of lists of ints". Not only is it ugly to write and read, it gets worse whenever you have any errors involving it. Ever seen a C++ compiler error message with templates involved? Other static languages like C don't even really try to deal with datastructures and just leave it up to the programmer to manually access the memory.
- lallysingh 10y ago> A language created 33 years ago now with no intention of being used as it is today. You know that they update the language regularly, and have a games sig? https://groups.google.com/a/isocpp.org/forum/#!forum/sg14 https://groups.google.com/a/isocpp.org/forum/#!forum/sg14
- oblio 10y agoYeah, but C++ has so much baggage with it. It could really use profiles. Strict mode or something, where the code should only use N "good practice" features.
- lallysingh 10y agoThose are called style guides. Or use the "official" C++ core guidelines. Teams choose/write one and use it as a basis during code review.
- deleted 10y ago[deleted]
- petre 10y agoD managed to fix most of the C++ annoyances and interfaces quite well with C and C++ https://dlang.org/spec/cpp_interface.html https://dlang.org/spec/cpp_interface.html
- bb88 10y ago> Look at the web in 2016, the technology is a complete disarray So that's pretty much been that way since the Java plugin for Netscape Navigator. That started the plugin battle which morphed into the mess we're in today. > Look at the game industry in 2016, where C++ is thrown around as the the cause and solution to all life's problems. Software written in C/C++ often have LUA/Python/Perl plugins to add scriptability. > The advantage of static typing is obvious to me; the more my computer understands of my code, the less work I have to do. Nope. Computers don't understand code, they just processes it and point out where your errors are, there's very little understanding. Type checking is really just rattling off a checklist to validate the type being passed around is the type that's expected.