3 ms·
The general consensus for the argument where dynamic languages are better and easier to use are * Safety: Each data carries it's type at run-time, there are no
by rurban 9y ago
The general consensus for the argument where dynamic languages are better and easier to use are
* Safety: Each data carries it's type at run-time, there are no overflow or NULL ptr problems as in statically typed languages. E.g. arithmetic is exact. Memory Safety.
* Easier to develop and debug: You don't have to get right at the first, time, you can iteratively improve the code, e.g. via debugging or refinements, until it works correctly. With statically typed language you have to first make it compile and fix all the errors at once. Generic data structures and methods are much easier to use than specialized.
- dragonwriter 9y agoThat's an odd consensus since neither exact arbitrary-precision arithmetic nor run-time type information, nor null or memory safety have anything to do with the static/dynamic distinction. I think there's also no consensus that forcing you to run code to (maybe, if you happen to have chosen the right input values) find errors that could be caught statically really makes it easier to develop.
- mikebenfield 9y agoI'm sorry, but I have to disagree with the first point. Static vs dynamic typing doesn't have much to do with safety. Haskell, Standard ML, OCaml, Rust, and many others have memory safety and no null pointer issues. Exact arithmetic and overflow also has nothing to do with type systems. There are statically typed languages other than C and C++, and virtually all of them from the last 20 or more years address the issues you list here. (I personally would also disagree with your second point, but that is more a matter of opinion.)
- adwn 9y agoThere is so much wrong with this... > Safety: Each data carries it's type at run-time With a statically typed language, this is not necessary for safety, since the compiler has already checked that the types are correct. > there are no overflow Do you mean integer overflow? This is completely orthogonal to the static/dynamic typing distinction. > or NULL ptr problems as in statically typed languages This is also completely orthogonal to the static/dynamic typing distinction. Remember that C and C++ do not constitute the entirety of statically typed languages. > E.g. arithmetic is exact What does this even mean? > Memory Safety. Again, C and C++ do not constitute the entirety of statically typed languages.
- rurban 9y ago> With a statically typed language, this is not necessary for safety, since the compiler has already checked that the types are correct Consensus is that static type checking did not help in ensuring memory and concurrency safety (sans the 2 or 3 weird safe languages nobody uses or knows about). The compiler cannot ensure these safeties when the language and VM is too poor to ensure it. I only know ATS, Pony, Idris, Agda and a few more who can ensure proper compile-time safety. Of course static type aficionados are in denial on this point. This is the argument mostly from the LISP community. For the static folks their type system is good enough. Fine for them. Other languages just do it better. As history has shown dynamically typed languages can easily ensure much more safeties. Esp. arithmetic safeties, with overflows, from int to bigint, from ops to rational, from double to bigfloat, ... This is not at all orthogonal to static/dynamic typing distinction, as the static type systems forbid that. Did you see any union typed arithmetic? Most dynamic languages have that. > NULL ptr problems completely orthogonal ... Of course not. I only know a few NULL safe statically typed languages nobody uses. Dynamically typed langs check for these issues in the runtime, thus are safe. > E.g. arithmetic is exact. What does this even mean? Oh my. Hope you will never be allowed to work in finance. I know nobody cares about getting numbers right, but speed is not everything. Avoiding underflows and overflows, guaranteeing exact arithmetic with proper type promotions. Ever heard of bigint or rationals? The world doesn't consist only of int, double and decimal. And with e.g. SBCL you have speed and safety. > Memory Safety. C and C++ ... But mostly. Add the next 3: Java, Rust, Go from which Rust is also not memory safe.