r/Compilers • • 17h ago

Haze Programming Language

https://www.haze-lang.cc/
0 Upvotes

43 comments sorted by

View all comments

3

u/Aaron1924 11h ago

Looks like an interesting project! I'm personally very excited about Verus and Creusot, which add compile-time verified function specifications to Rust, and I'm always happy to see new languages where these features are part of the language design, rather than bolted on retroactively.

Two things that confused me while reading though the documentation:

  • The website states that "all contracts are checked at compile time", which sounds similar to what Verus & Creusot do, where everything is checked by SMT solvers statically, and only provably correct programs compile. But the docs later clarify that "contracts are evaluated at compile time when the compiler has enough information, at runtime otherwise".Even worse, the examples imply that the compile-time prover is essentially just constant folding, meaning any interesting statement about function inputs ends up being a runtime assertion.
  • The other flagship feature from the homepage, the "Immix Collector", is only the "intended" design. According to the docs: "the current runtime implements a parallel mark-and-sweep subset". So the claims about this garbage collector are also misleading.

1

u/Top_Marionberry_4413 11h ago

SMT solvers sound good but in practice if the compiler cant prove your program is correct, it doesnt compile, or it just allows everything, which makes them impractical, and the DX just ends up being terrible, with the contracts being an obstacle instead of an assistance.

The runtime checking thing means that the compiler forces you to use Result[T, E] if it cant prove something, which is much better than not compiling at all, and means that the program doesnt abort at runtime because of something that couldnt be proven at compile time. Hope that helps.

2

u/Aaron1924 11h ago

I mean it's a valid design choice to make runtime assertions a built-in language feature; D, Ada and Eiffel do something very similar, and some modern languages (e.g. Zig) have built-in unit testing. It's just that none of these language claim that "all contracts are checked at compile time".

-1

u/Top_Marionberry_4413 11h ago edited 11h ago

well this one does, isn't that great? :) they are all checked, the unchecked ones become Result types that need to be unwrapped. so even they are checked.

hey whoever downvoted fuck off im trying to have a conversation here. jeez, reddit cucks, am i right aaron?