News for hackers. Stuff that matters.
Re:Statically-typed error handling in Python using Mypy by igor47 on Sunday December 08, 2019 @01:19PM (#21737244)
Why do dynamic languages excel when failure is not so bad? What makes non-dynamic (compiled?) languages better when failure is bad?

I'm parsing your comment to mean, "it's easier to write correct code in compiled languages", but this is not obvious to me, or anyone who's, for instance, written any C at all.

Re:Statically-typed error handling in Python using Mypy by Reelin on Sunday December 08, 2019 @02:47PM (#21737822)
C is the wrong comparison to make here - it's extremely low level. Java or perhaps C++ would be much closer.

* Ahead of time compiled languages reduce flexibility but allow the compiler to do more reasoning about the system.

* Statically typed languages allow the compiler to reason about the assignments you make and methods you call. If the language is also AOT compiled, you avoid crashing at runtime.

* Dynamically typed languages significantly reduce boilerplate and avoid the mental effort of expressing an idea in a rigorously typed manner. It's the "hold my beer" approach.

Re:Statically-typed error handling in Python using Mypy by pytester on Sunday December 08, 2019 @03:08PM (#21737966)
C is a good example precisely because it highlights the fact that explicit typecasts and memory safety are a LOT better at preventing bugs than static types.
Re:Statically-typed error handling in Python using Mypy by viraptor on Sunday December 08, 2019 @07:00PM (#21739392)
> Why do dynamic languages excel when failure is not so bad?

There's a usual confusion of banking in this case, but if we're talking about popular dynamic/memory-managed languages, you can put an equivalent of:

    try:
      actual code
    except:
      log.exception
      
At a high level and be fairly sure things will be ok in a long run even with failures along the way.

On the other hand, most static-typed systems handle failures explicitly.

I think C is a bad example here. We've come a long way since C. We know how to do better.

Unless you want to include the ecosystem as well. C + valgrind + PVS + clang-analyser do make it easier to create correct code.

Re:Statically-typed error handling in Python using Mypy by joshuamorton on Sunday December 08, 2019 @09:30PM (#21739967)
Wait but you can do that pattern in any language (java or cpp, both of which are static, and one which is unmanaged).
Re:Statically-typed error handling in Python using Mypy by viraptor on Monday December 09, 2019 @01:08AM (#21740727)
You can't really do it in c++ in the same way. If you mess up you will crash on invalid memory reference. With Java, you'll catch a bad cast or a null ref exception instead.