3 ms·
That expressly ignores what I set up as my criteria, so I'm unsure why you presented this. Even if that does cause a crash, which is entirely dependent on the
by kbenson 10y ago
That expressly ignores what I set up as my criteria, so I'm unsure why you presented this.
Even if that does cause a crash, which is entirely dependent on the language, I think there's a clear delineation of whether something can be expected to crash or not based on the opt-in assumptions of the language you choose. If your language is not type-safe, you've already accepted that as a constraint ("types may not help you"). Should we expect addition to be implemented in some way that causes problems within the constraints you've already accepted? I think not.
Here's two specific examples of dynamic languages, one weakly typed (Perl), one strongly typed (Python), and how they are internally consistent.
# perl -E 'say 1 + "2" + "four" + 8'
11
# python -c 'say 1 + "2" + "four" + 8'
File "<string>", line 1
say 1 + "2" + "four" + 8
^
SyntaxError: invalid syntax
Each makes it clear what you can expect up-front. If python could occasionally crash from addition of two integers, or Perl would occasionally interpret an all alpha string as non-empty in numeric context, all for the name of being slightly faster, I would consider that the wrong thing to do as well. (Note: There are rules for how mixed alphanumeric strings are interpreted in Perl, but they are well defined).
- jdmichal 10y ago> I think there's a clear delineation of whether something can be expected to crash or not based on the opt-in assumptions of the language you choose. I can say exactly the same thing about StringBuffer vs StringBuilder, with the obvious substitution for the word "language". The point of kodablah's post is that, if your stance is that safety should always be chosen over other practical concerns, then a natural conclusion is that you should by default be opposed to dynamic languages, as they trade type safety for programmer comfort (for lack of a better term). EDIT: I also want to point out that "crashing" vs throwing an error is not a distinction worth making for this conversation. If your program stops executing for any reason that could be prevented by a type-checking system, then it seems reasonable to call a type-checking system a safety feature.
- kbenson 10y ago> I can say exactly the same thing about StringBuffer vs StringBuilder, with the obvious substitution for the word "language". Sure. And if you think the the difference in developer efficiency between a dynamic language and a static one is less than 10%, but when the gains are small, as has been shown in the linked article, then why pay the cost of possible program failure for a less than 10% gain in string concatenation speed when you probably won't event see it? > I also want to point out that "crashing" vs throwing an error is not a distinction worth making for this conversation. If your program stops executing for any reason that could be prevented by a type-checking system, then it seems reasonable to call a type-checking system a safety feature. I disagree. Exceptions which can be caught are not comparable to memory corruption, unless you can ensure the corruption can not cause a segmentation fault (which may be the case here, I have no idea). Nobody seems to be answering my question as to what type of problem the threading error is limited to in Java. I've made clear that any objection I have to the default is moot based on possible assurances that the JVM might provide, but I haven't had anyone clarify.
- jdmichal 10y ago> Sure. And if you think the the difference in developer efficiency between a dynamic language and a static one is less than 10%, but when the gains are small, as has been shown in the linked article, then why pay the cost of possible program failure for a less than 10% gain in string concatenation speed when you probably won't event see it? I actually think that dynamic languages have negative efficiency impact over long periods of time and large numbers of developers. (If that doesn't make it clear where I stand on static vs dynamic typing...) > Exceptions which can be caught are not comparable to memory corruption... I never compared exceptions to memory corruption, I compared them to crashes. I could also "catch" crashes with techniques such as watch-dog processes with very similar effects. Now if you really mean "crashes" as "program faults due to memory corruption", as opposed to "unexpectedly halting execution", then you're both using a niche definition and gave a bit of deceiving definition of "unsafe": > To be clear, what I mean here by unsafe, and everywhere I've used the word, is "can cause a crash or memory corruption"...
- kbenson 10y ago