The need for a formally verifiable mainstream programming language (opens external site)
View full thread · View on Hacker News
To get push notifications on iPhone or iPad, add Hack and Chat to your Home Screen: tap Share → Add to Home Screen, then open the installed app and enable push in Settings.
View full thread · View on Hacker News
Much of what the author wants already exists!
Replies (4)
If a language cannot balance tradeoffs between hardware and software, people will still use the most performant language, especially for resource-intensive tasks, so you end up with what we currently have. We need to rethink how we can design a language that is token-efficient, offers memory safety, is close to the metal, and lastly implements formal verification guarantees. The closest what we have to this is Rust and C++, but it's not good enough.
Replies (2)
This is ironic considering the default GC strategy for GHC's RTS is a copying collector that puts values physically close if they are used together plus bump allocation. That has good cache side effects (heh).
Replies (1)
Exploring laziness was one idea behind Haskell, one of many. And we learned a lot by doing it. But we also learned that the costs (in terms of execution, complier complexity, debugging, and even internal consistency in the language) are extremely high.
Laziness is not what lets you do equational reasoning in Haskell. The fact that you manage side effects, that's what lets you do equational reasoning. That is a feature of the type system, it has nothing to do with laziness.
Replies (1)
But on the subject, laziness plays a considerable role in equational reasoning. Equational reasoning is simplified by it. For instance, these two expressions are equivalent in Haskell, but are not equivalent in a strict language.
Hence you can apply the rule that "let x = <expr> in <e2>" is equivalent to <e2> with x inlined, other than that the computation is only done once.Or if "f" is a function that is equivalent to "const 1", then "f (1 `div` 0)" should simplify to 1, not to bottom.
It also lets you write this kind of code (taken from Rosetta Code):
In this case, not having to prove totality makes the rest of the code easier. I deliberately chose this example and not the classic 3-line version with trial division because it's not inefficient and yet it still uses laziness to make the program simpler.And historically the reason why laziness was favored was because it enabled modularity better.
That is partly why I think laziness is worth having.
A Haskell without laziness would basically be a programming language from a different tradition. It has never been a "correctness at all costs" programming language, as I already stated in my previous comment. It may be that such a programming language is what those who design it want, but that isn't what it is.