Lisette - A little language inspired by Rust that compiles to Go

It looks nice, yesโ€”this could be a better version of Go. It has elements of Rust and Vlang. A very interesting compromise.

https://lisette.run/

#golang #rust #vlang

Lisette โ€” Rust syntax, Go runtime

Little language inspired by Rust that compiles to Go.

@leobm why not go all-in into Rust?
@psyhackological I only partially understand the
hype surrounding Rust. Itโ€™s certainly a nice language, with good error handling and so on. But itโ€™s also very complex; Go is much simpler and perfectly adequate for 90% of the requirements one has for a programming language. Iโ€™m only a limited fan of Rust; if I needed full control over memory, Iโ€™d probably go with #ziglang instead.
@psyhackological With Rust, I still feel like Iโ€™m spending more time wrestling with the type system than actually coding and getting things done. I often have similar feelings with Haskell, and sometimes with Scala too. Maybe Iโ€™m just not smart enough for Rust ๐Ÿคท๐Ÿปโ€โ™‚๏ธ
@leobm type system is actually Rust's super power and also in Go it shouldn't be neglected (or Haskell / Scalla). 90% of problems (and bugs) in my daily job comes from improper type value and missed validation. The only thing I can complain (and Rust Foundation team are aware of) are lifetimes. There is no struggle in Go as it has built in GC in each binary. Rust must be "tip top" however it's possible to create memory leak.

@psyhackological Iโ€™ve come to realize that a type system isn't always the silver bullet itโ€™s made out to be. At the end of the day, you're almost always starting with strings or binary data. You can define beautiful types and structures, but they often fail to catch real-world errors, which then just pop up at runtime anyway. In my experience, most errors occur because you have incorrect/unexpected input data.

For me, types are mostly useful for large-scale refactoring or IDE code completion.

@psyhackological Otherwise, Iโ€™ve actually found static typing to be a bit of a hindrance lately, especially when dealing with highly dynamic data. Dynamic languages are just more flexible. For instance, #Erlangโ€™s pattern matching helps me way more than a formal type system ever could. Or look at #Clojure with tools like Malli or core.specโ€”combined with REPL-driven development where you test functions live
@psyhackological in the editorโ€”itโ€™s just a different level of flow. Iโ€™m torn: I appreciate the theory of static types, but I keep being reminded of how elegant and flexible dynamic languages can be.

@psyhackological I actually find e.g. #Rakulang's approach quite interesting too. Gradual dynamic typing. For example, using `subset`
```raku
subset Age of Int where 0..120;
my Age $my-age = 25; # OK
my Age $old-age = 150; # Error: Type check failed

subset Username of Str where /^ \w ** 3..15 $/;
my Username $user = โ€œr2d2_detectiveโ€; # OK
my Username $bad = โ€œyoโ€; # Error
```

@psyhackological
```raku
subset
NonEmptyList of List where *.elems > 0;
sub process-data(NonEmptyList $data) {
say โ€œprocess โ€ ~ $data.elems ~ โ€œ...โ€;
}

process-data([1, 2, 3]); # Okay
process-data([]);

```

or things like multi-dispatch e.g.:
```raku
proto fib (Int $n --> Int) {*}
multi fib (0) { 0 }
multi fib (1) { 1 }
multi fib ($n) { fib($n - 1) + fib($n - 2) }
```