News for hackers. Stuff that matters.
Re:Languages on BEAM, the Erlang virtual machine by kazinator on Saturday January 21, 2017 @02:03AM (#13449212)
> won't know it's wrong until you run the program

That's a big problem, indeed, if your goal is to ship code that was never executed.

Re:Languages on BEAM, the Erlang virtual machine by lomnakkus on Saturday January 21, 2017 @05:13AM (#13449570)
> if your goal is to ship code that was never executed.

That's cute, but no. There's a lot of code that only gets executed once in a blue moon and if my experience[1] is anything to go by, this is where types really shine. (Before you say "tests": The amount of code bases I've experienced in dynamically checked languages with no meaningful test coverage is shocking. That, and tests can only show the presence of bugs.)

Types are also hugely valuable as compiler-checked API documentation, especially if side effects can be document as in e.g. Haskell or Idris.

(I'm obviously assuming non-trivial type inference as in e.g. Haskell or O'Caml. If we're talking anemic type systems like Java or C#, then the trade-off becomes a lot harder to justify, at least for me. In these cases you can indeed remove a non-trivial amount of "ceremonial" code and the type systems indeed have very few useful guarantees like non-nullness and such.)

[1] We're all trading anecdotes here, let's be honest about that.

Re:Languages on BEAM, the Erlang virtual machine by lobster_johnson on Saturday January 21, 2017 @02:12AM (#13449227)
But the whole point of type systems is that you can theoretically verify your code at a high level (though very few computer languages are able to approximate anything like a mathematical proof).

I wrote about this in another comment, in the context of writing tests.

Re:Languages on BEAM, the Erlang virtual machine by kazinator on Saturday January 21, 2017 @04:03AM (#13449439)
In theory, practice is the same as theory. In practice, it isn't. I've seen only toy examples of some non-trivial program properties being encoded in type systems. It nowhere constituted proof of an entire program. Nobody actually does that. A lot can remain wrong in code which passes type checks. There is no "if it compiles, ship it". Not to mention that compilers can have bugs, and that hidden performance and resource problems can lie latent in high level languages.
Re:Languages on BEAM, the Erlang virtual machine by njs12345 on Saturday January 21, 2017 @06:25AM (#13449675)
How about the property 'this variable is never null'? You might call this trivial but it seems to be useful given that real-world programmers get it wrong frequently: http://stackoverflow.com/search?tab=newest&q=NullPointerExce...

Or the property 'this variable is never used after a free' in a language with manual memory management (Rust encodes this) or 'this program is free from data races' (also Rust)?

No one is arguing that strong static type systems make it impossible to write programs with bugs, but eliminating whole classes of bugs at compile time certainly makes it easier.