A Perfectable Programming Language
This piece champions Lean as a "perfectable" programming language, highlighting its unique integration of dependent types, metaprogramming, and a powerful theorem prover. The author argues that Lean allows developers to write provably correct code and build custom syntax with unparalleled seamlessness, offering a glimpse into its advanced capabilities. It's popular on HN for showcasing how Lean, unlike its peers, is gaining significant traction and pushing the boundaries of what a programming language can achieve.
The Lowdown
The author introduces Lean as a programming language that stands out due to its 'perfectable' nature, meaning one can write and verify properties about Lean code within Lean itself. This capability is presented as a natural evolution in programming, addressing the universal desire to formalize properties of code.
- Dependent Types as Core: The article posits that dependent types are fundamental to achieving this 'perfectability.' They allow the language to inherently understand and verify properties of functions and data, moving beyond traditional type systems to enable full-fledged theorem proving.
- Seamless Metaprogramming: Lean's metaprogramming capabilities are highlighted as exceptionally smooth, allowing for the creation of custom syntax and domain-specific languages directly within the code. An elaborate Tic-Tac-Toe example demonstrates how custom board notation can be defined and elaborated, showcasing powerful API design.
- Optimization Potential: While not yet Rust-fast, Lean's ability to formally prove the equivalence of two code segments offers a high ceiling for future optimization. This provable equality allows for aggressive compiler transformations with confidence.
- Growing Community: The author notes that Lean is uniquely gaining significant traction among languages in its class (like Coq, Idris, and Agda), positioning it as the leading choice for those seeking a practical programming language with robust theorem-proving capabilities.
In essence, Lean is presented not just as a programming language, but as a framework where code correctness and customizability are fundamental, driven by its advanced type system and integrated theorem prover.