4 ms·
>I don't think I agree, it's very beneficial to catch a bug at compile time (or at least 'type-check time') rather than at runtime. It's particularly valuable f
by deltaonefour 4y ago
>I don't think I agree, it's very beneficial to catch a bug at compile time (or at least 'type-check time') rather than at runtime. It's particularly valuable for refactoring. Even if it's easy to trace a runtime error, it's still a win to transform it into a compile-time error, or a bright red line in an IDE.
Well explain python then. Why is python easier to work with then C++? There is literally so much raw data to back up my statement on how python is "easier" then C++. Anyone who has worked extensively with both languages, and I mean very extensively, knows how painful C++ is compared with python.
I think you may not agree. But that's just your own unique opinion. In general, I'm the one who's right.
>An error might be very rare or might only occur when a malicious action is taken, so it's important for a language to be helpful in writing correct code. Consider a buffer-overflow in a C codebase that only happens when a malicious packet is received.
So what's your point? Your stating this because of what?
>Of course, type systems aren't the only way for a language to help the programmer write correct/safe/secure code.
Why are you telling me this? Did I say type systems were the only way?
>That's an improvement in safety when compared to what standard C gives you (undefined behaviour of course), but doesn't relate at all to type systems.
Another improvement is to make a programming language that is impossible to crash. Several languages already have this ability. But this is a tangent. Again I really don't want to dive to deep into this.
The point remains this: Python is more safe then C++ despite having more holes for crashing and no type system. Can you prove otherwise or not?
- MaxBarraclough 4y ago> explain python then. Why is python easier to work with then C++? This isn't an apples-to-apples comparison. They're very different languages, in terms of everything from memory management to build models to type systems to concurrency to historical baggage. Python is certainly more writeable than C++, for countless reasons. In terms of maintainability, Python's dynamic types are a disadvantage, but Python is also a much simpler and safer language than C++, which is very beneficial. > I think you may not agree. But that's just your own unique opinion. In general, I'm the one who's right. Please refrain from this kind of thing on HackerNews. > what's your point? Traceability of errors isn't everything. It's also important for a language to help the programmer avoid introducing defects in the first place. Neither Python nor C++ do this particularly well. Neither is anywhere near, say, Ada or Haskell. > Why are you telling me this? Did I say type systems were the only way? There's no reason to be defensive. Not everything is a refutation. > Another improvement is to make a programming language that is impossible to crash. Several languages already have this ability. I'm not certain what you mean here. Which languages are you thinking of? It's very often useful for a language to have runtime checks that may result in immediate termination, rather than continue with unaddressed erroneous execution. Examples are when Java throws on an out-of-bounds array access, or on divide-by-zero, or on dereferencing null. > Python is more safe then C++ despite having more holes for crashing and no type system. We're agreed on this point, although I'm not sure I'd say Python has more holes for crashing. Python is the safer of the two languages. [0] C++ is a minefield of undefined behaviour, [1] Python is not. Our discussion has not been limited to safety. [0] https://news.ycombinator.com/item?id=31223659 https://news.ycombinator.com/item?id=31223659 [1] https://news.ycombinator.com/item?id=31224310 https://news.ycombinator.com/item?id=31224310
- deltaonefour 4y ago>This isn't an apples-to-apples comparison Sure but the comparison or topic at hand was safety. In the case of safety, python is more safe. >Please refrain from this kind of thing on HackerNews. Why? I'm saying the general opinion among most people is that my point is correct. Your point is unique and more exclusive to you. Why refrain from stating general opinions and distinctions? I think you should refrain from telling people not to state reasonable things. >In terms of maintainability, Python's dynamic types are a disadvantage, Safety is correlated with maintainability. Before I address this, let me say that python now has type annotations and when paired with external type checkers during build time, python effectively becomes a statically typed language with compile time type checking and a type system more consistent and powerful then C++. That being said. My claim is EVEN without using type annotations, python is by far more safe and more maintainable then C++, simply because of higher traceability of errors. >Traceability of errors isn't everything. It's also important for a language to help the programmer avoid introducing defects in the first place. Yes of course. But again this isn't the point. The point is python vs. C++. That being said my claim on the side also supports the notion that error traceability is more important then pre-compile time safety. >There's no reason to be defensive. Not everything is a refutation. Not being defensive. Just not seeing the point. There's a topic, but your introducing topics that are obvious? It's like you saying the sky is blue. Thank you for letting me know, but why? >I'm not certain what you mean here. Which languages are you thinking of? Crashes or undefined sections of a language are defined by the language itself. You can always design a language where every hole is filled. Outside of using up too much memory and FFI there are languages that are defined so that they can never crash and that there is zero undefined behavior period. >It's very often useful for a language to have runtime checks that may result in immediate termination, There are languages that don't even compile with out of bounds access. Such languages force you to write handler logic in order to even work. >We're agreed on this point, although I'm not sure I'd say Python has more holes for crashing. Python does have more holes for crashing. The thing is those holes aren't "undefined" though. They're very much defined behavior. That's why they're so traceable, but these are still holes in my mind because there are languages so safe that crashing holes don't even exist. >Our discussion has not been limited to safety. No it has not. but mainly because you've been taking it on tangents. I've been addressing your tangents but the main point is: Python is safer then C++. If we agree then the discussion is finished in my mind. I stated that here. https://news.ycombinator.com/item?id=31225265 https://news.ycombinator.com/item?id=31225265 I mean I'm ok with tangents but in a lot of discussions, this one included, the tangents are introduced in a way that obfuscate the main point. There's a discussion where I'm trying to prove a singular point and then suddenly one person introduces 20 different topics and pretty soon the singular point is lost in the weeds. Nobody was a definitively right or wrong.