News for hackers. Stuff that matters.
Re:Weird Expressions in Rust by kuschku on Saturday June 28, 2025 @12:51AM (#44402365)
Kotlin also has this type, it's called "Nothing".

https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-nothin...

As you can never get a value of type nothing, it can coerce into anything, just like rust's ! or () or typescripts never.

Re:Weird Expressions in Rust by nialv7 on Saturday June 28, 2025 @01:19AM (#44402452)
I recently realized (by playing with Lean) that coercing of "!" is because of the principle of explosion [1]. Basically propositions are types in Lean, and proofs are instances of those types. A proposition that is false doesn't have any instances, so they are like "!". Principle of explosion says ∀ P, False -> P, which is exactly the type signature for "!" coercing.

[1]: https://leanprover-community.github.io/mathlib4_docs/Init/Pr...