Children of Scala

I have been programming since 1970, using Java since 1995, and Scala since 2005.

I have had a love-hate relationship with Scala, and learned to love Kotlin.

More recently, I have learned to love Rust.

But I want more… As Scala improved on Java and inspired Kotlin, I want a language like Rust, but without the warts I see in Rust—a version of Rust, more like Pascal.

Sadly, Scala inherited the ugliness of Java, C++, and C… and I understand the utility of that. That is the ugliness of Rust; it looks too much like A, B, C, C++, C#, and other alphabetic soup.

However, when I look beyond the surface of Rust, I see the wisdom and insight of Scala.

People may laugh, but my favourite feature in Scala 3 is

val result = if condition then
  // Code to execute if condition is true
  valueIfTrue
else
  // Code to execute if condition is false
  valueIfFalse

This looks more like Pascal than C, and is more readable and easier to reason about. It reduces cognitive load.

Unlike Scala, the Rust compiler generates diagnostics that do not require a PhD to interpret. Still, in some areas, the Rust diagnostics are atrocious. This tells me the compiler designer/engineer has no fucking idea what they are talking about. If you cannot explain it, you do not grok it.

My fantasy is a language called “robust,” rhymes with “rust,” but promises more. I would create “program.rb” files, which compile into webasm at first, and I could launch them into a web browser, or cloud engine, and ideally, under IntelliJ iDEA.

I love Rust, but fantasize about next-level programming. Rust proves we don’t need garbage collection, and robust should not either. Caprese is a good idea, and may influence robust, but I want more than Caprese. Garbage collection should be an ‘imported’ capability, not a base requirement. More generally, a ‘runtime’ would be an optional ‘capability’ where one could add it when desirable.

Also, Java Loom is brilliant, proving we don’t need hacks like async/await. robustwill learn from blocking code such as Loom, Structured Concurrency, and Structured Scope. NO MORE FUCKING IMPLICIT THINKING!

Other features… no nulls, no exceptions, no past failures.

So, Mr. Odersky, and your bag of geniuses, please consider the robust programming language. You could bootstrap it by writing the compiler in Rust. :wink:

1 Like

Scala Native does something like this, it has optional garbage collection. (It’s not at the “language level” of course :smiley: , handled in build settings.) You can select Boehm, Immix, Commix, or no GC.

2 Likes

I wouldn’t say Scala Native has optional garbage collector - there is either one of Boehm, Immix (defualt), Commix, or there is None.
While the other 3 are actual, performant garbage collectors, the None is a garbage pile - you allocate and never retain… or at least as long there is some space left, when it’s gone there’s unrecoverable OOM

The only actual GC-free solution that can potentially work was based on the capture calculus experiments Safe Zone: Memory-safe zone ensured by capture checking and GC. by yawen-guan · Pull Request #3120 · scala-native/scala-native · GitHub - it alowed to allocate objects using deisgnated arena allocator, instead on the GC heap. The problem with that is that it’s really viral - each field of the class would need to be tracked if we want to erase need for GC, thus it makes it hard to use right now.

3 Likes

Thanks, looks like I had a misunderstanding about it.

People are displeased with the ergonomics of Rust, but it’s worth considering that it may be the best we can have. And there is a clear tradeoff that Rust highlights … GC makes sharing cheap and without a GC, sharing isn’t cheap.

And this has consequences in Rustlike not being a great idea to work with persistent data structures, because for that you need Rc/Arc. And so you end up with a poor-man’s GC, because it can’t do many optimizations without a managed heap with clear boundaries. GC isn’t really something optional, unless you want to settle for less.

Rust has a different paradigm, essentially limiting sharing, and also immutability is a property of the memory region instead of the data structure. E.g., Strings in Rust are mutable, which is cool given the mechanisms it has for safety, but it should also be pretty clear for instance that…

Rust isn’t a functional programming language, and people have a much easier time doing FP in Java, Javascript, or most other GC-managed languages. And also, mainstream GC-managed languages are more productive than Rust.

Of course, the industry sorely needed Rust to happen, but IMO there isn’t much progress you can make without a GC, and Rust’s UX is actually pretty good, all things considering.


Speaking of Pascal, I got started with Turbo Pascal and I hated it. C/C++ was a breath of fresh air. One thing I liked about C/C++, for example, was the ability to declare new variables in any lexical scope, marked by brackets. Or that for better or worse it had standards, so jumping between different compilers was very doable.

IMO, the entire attraction with Pascal was due to the IDEs produced by Borland.

1 Like