Rust
How to make Rust
a realy decent language.
- everything is immutable by default, explicitly annotate everything mutable.
mut
keyword for mutable things:=
for imperative assignment (should be rare)=
to do universal pattern-matching and variable binding- support for Algebraic types, especially proper sum-types and GADTs
- Capitalized data-constructors, type inference for Algebraic types.
- pattern-matching on data-constructors everywhere
- multi-clause functions (a set of partial functions)
- type-classes from Haskell (proper set-like relations on interfaces)
- just copy Ocaml module system (with more uniform syntax).
Notice that type-classes solve the specification problem, providing more structured approach (the set-subset relation) than a bunch of assertions (as in CLU).
Literally all languages should use them and Ocaml modules, which is the same fundamental structuring mechanisms (set-subset + application) at a higher level.
Anyway, just move from C++-sh imperative crap to Ocaml’s and Scala’s syntactic forms, keeping all the imperative crap as a subset.
Mutable, imperative subset should be a more verbose explicit DSL, not a whole of language.
In brief, take every high-level feature form decent languages, like
Ocaml
or Scala 3
without breaking too much. Just like Python or Scala 2 to 3 migration.
Again, there are enormous fundamental benefits of having pure-functional defaults and explicitly annotated imperative features as a subset.
Scheme with just (set! ...)
syntactic form was the true enlightenment.
Decades of ML
and Ocaml
(and recently Scala 3
) also converged to the same principles.
A mostly-functional language with imperative features it the way. Bell
labs successfully researched use of Standard ML
as a system language,
but, of course, zoomers never heard of this.
Common Lisp
was also a system language, which proves that being
high-level is OK.
Actually, there, probably, no way of fixing Rust. It is better to start
a new F#
and Scala
-based language, minimal, clean, principle-guided, like
Scheme
used to be. And just like Haskell or Ocaml or F# have proven -
syntax matters /a lot.