Lisette a little language inspired by Rust that compiles to Go
83 points by jspdown 5 hours ago | 36 comments

virtualritz 2 hours ago
Looks great.

But I can't help wondering:

If it is similar to Rust why not make it the the same as Rust where it feature-matches?

Why import "foo.bar" instead of use foo::bar?

Why Bar.Baz => instead of Bar::Baz =>? What are you achieving here?

Why make it subtlety different so someone who knows Rust has to learn yet another language?

And someone who doesn't know Rust learns a language that is different enough that the knowledge doesn't transfer to writing Rust 1:1/naturally?

Also: int but float64?

Edit: typos

reply
sheept 52 minutes ago
These are just syntax differences, which not only are easy to learn but I believe aren't the primary goal of the language, which is to bring the benefits of Rust's type system to Go.

As for int and float64, this comes from Go's number type names. There's int, int64, and float64, but no float. It's similar to how Rust has isize but no fsize.

reply
thrance 55 minutes ago
I think "Because (the dev) prefers it that way" is a satisfactory answer. Often, these small languages don't aim to be used in production and become the next big thing. They're made for fun and exploration's sake.
reply
baranul 3 hours ago
There are several languages that compile to Go, trying to be a better a Go. Off the top of my head: XGo (https://github.com/goplus), Borgo (https://github.com/borgo-lang/borgo), Soppo (https://github.com/halcyonnouveau/soppo)...
reply
amelius 2 hours ago
How do compile errors propagate back from the target language to the source language?
reply
usrnm 2 hours ago
They are not supposed to produce code that doesn't compile, why would they?
reply
debugnik 42 minutes ago
Debugger positions on the other hand are a pain with these things.
reply
emanuele-em 4 hours ago
Really nice work on this. The error messages alone show a lot of care, the "help" hints feel genuinely useful, not just compiler noise.

I'm curious about the compiled Go output though. The Result desugaring gets pretty verbose, which is totally fine for generated code, but when something breaks at runtime you're probably reading Go, not Lisette. Does the LSP handle mapping errors back to source positions?

Also wondering about calling Lisette from existing Go code (not just the other direction). That feels like the hard part for adoption in a mixed codebase.

Is the goal here to eventually be production-ready or is it more of a language design exploration? Either way it's a cool project.

reply
lucianmarin 2 hours ago
A programming language similar to Python that compiles to Rust or Go will be amazing.
reply
rubymamis 2 hours ago
Mojo is a language with Pythonic syntax that compiles to fast machine code built by the creator of Swift: https://www.modular.com/open-source/mojo
reply
Hasnep 2 hours ago
Spy (https://github.com/spylang/spy) is an early version of this kind of thing. I believe it compiles to C though, kinda like Nim. Actually speaking of Nim, that's probably the most mature language in this space, although it's less platonic than Spy
reply
emmelaich 2 hours ago
Here you are. https://github.com/google/grumpy

Last commit was 9 years ago though, so targets Python 2.7.

reply
amelius 2 hours ago
What benefit would it bring? There's already https://cython.org/
reply
mememememememo 2 hours ago
You want to use the Go runtime for example
reply
ksec 33 minutes ago
On the surface this looks great. Seems to hit the sweet spot in a lot of areas.

I know it is Rust inspired, but why write it in Rust and not Go?

reply
bhwoo48 39 minutes ago
Love the idea of bringing Rust ergonomics to the Go runtime. As someone currently building infra-automation tools (Dockit), the trade-off between Rust's safety and Go's simplicity is always a hot topic. This project addresses it in a very cool way. Will definitely follow the development
reply
melodyogonna 2 hours ago
I'm wondering about the logistics of making this integrate with Go at the assembly/object file level rather than at source code level. What if it compiled to Go's assembly rather than to Go source code
reply
darccio 53 minutes ago
Having explored that approach (†), I can tell that generating Go assembly is harder than it seems.

†: I've tried to transpile Rust code through WASM into Go assembly, and I've also explored how to inject trampolines into Go binaries (which involves generating Go assembly too).

reply
melodyogonna 6 minutes ago
That is interesting, but I imagine Rust has features which can not be translated into Go's assembly. This language is specifically designed for Go interop; the logistics wouldn't be the same, though I still expect it to be difficult.
reply
rednafi 54 minutes ago
Go syntax and the Go runtime would be the perfect combo for me. Oh well...

I love Rust for what it is, but for most of my projects, I can’t justify the added complexity. Sure, there are a bunch of things I miss from the Rust world when I’m working on large-scale distsys services in Go, but introducing Rust in that space would be a recipe for disaster.

I guess the Go team knows that if they start adding everyone’s favorite Rust features, the language would become unrecognizable. So we’re not getting terser error-handling syntax or enums. Having union types would be nice too.

But I work in platform engineering, so my needs are quite different from someone writing business logic in Go. I understand that having a more expressive syntax is nice when you’re writing complex business code, but in reality, that almost always comes with a complexity/fragility tradeoff. That’s part of the reason no one wants to use Rust to write their business logic, despite it being so much more expressive.

For distsys, programming ergonomics matter far less compared to robustness and introspectability. So the Go runtime with Go syntax is perfect for this. But of course, that’s not true for all use cases.

Sorry for the rant - completely uncalled for. This is a cool project nonetheless :)

reply
sail0rm00n 3 hours ago
I’m sold just for proper enumeration support.
reply
rbbydotdev 2 hours ago
Looks beautiful! Any plans to make it self compile?
reply
bestouff 3 hours ago
For "classic" Rust what's actually nice is that no runtime is needed, so this looks like a step backwards.

What would be actually nice is running async Rust on the Go green threads runtime.

reply
andai 3 hours ago
In my experience, what's actually nice is the correctness. The low-levelness is not helpful for most of the software I write, and imposes a constant burden.

Rust, of course superbly achieves its goals within its niche! But it is a niche, is my meaning here.

What I actually want is code that's correct, but ergonomic to write. So my ideal language (as strange as it sounds) would be Rust with a GC.

I don't want to worry about what string type I'm using. I want it to just work. But I want it to work correctly.

Lisette looks like it's in this exact category! It seems to combine the best aspects of both Rust and Go, which is a very promising endeavour. I'll have to take a proper look :)

reply
mirekrusin 49 minutes ago
MoonBit [0] is the best/future complete/active “rust with gc”.

[0] https://www.moonbitlang.com

reply
akkad33 3 hours ago
You can use Ocaml today and achieve all the correctness
reply
IshKebab 2 hours ago
OCaml has a lot of other cons though that Rust doesn't have. I would definitely pick Rust over OCaml even for projects that can tolerate a runtime with GC pauses. (And clearly most people agree.)
reply
amelius 2 hours ago
What cons?
reply
zorobo 2 hours ago
For example, multicore OCaml is not free of race conditions. The GC, while super efficient (pauses are in the milliseconds), is not suitable for hard realtime.

Still, where absolute max performance or realtime are not required, I'd choose OCaml as it is elegant & a pleasure to code in (personal opinion, ymmv).

reply
gf000 3 hours ago
There are an endless number of modern MLs that do the same thing. That's not a novelty - Rust was novel in making it part of a low-level language.
reply
tux3 2 hours ago
I don't think being low level is the main innovation, really. There are several things Rust did right over traditional ML. Explicitly caring about learnability and the "weirdness budget". Having great error messages that don't require a course in category theory (many ML) or 800kB of scrollback buffer (C++) to understand.

Having great tools. Excellent documentation. Being friendly to new users.

Yes, it's also a systems language without a runtime. But that's not the novel part. You could write horrors in C++ that approximate ML even without language support. There are eldritch libraries where some kind of pattern matching is done via generic lambdas.

The main difference is developper UX. Good tools, good error messages, quality of life. The novelty is making ML not painful.

reply
furyofantares 39 minutes ago
It looks like more of a Rust-y way to write Go rather than a Go-ish way to run Rust. So I think the question is more about if you would choose it for something you're choosing Go for today, rather than for something you're choosing Rust for today.
reply
Imustaskforhelp 2 hours ago
No, this is actually nice to be honest. It's not a step backwards imo.

if I can incorporate Lisette into my golang projects for example, (Invoking rust code within Golang to me feels like a larger problem and Invoking C might be easier from my tinkering experiments) I feel like you are viewing this from a pure performance metric but to be honest, most things aren't necessary to be the fastest, the type system of rust/rust-alike languages can be beneficial to people as-it-is

Check out gleam, its based on erlang so it has a runtime involved, people love gleam because it gives them a bit more expressiveness in the type system from what I've heard.

I feel like these experiments are genuinely nice, Also perhaps a project like this can then slowly also invoke tinyGo (there was a recent discussion about it too) and could be compiled into tinyGo in future iterations to have no runtime essentially as well. People who love rust, love it, but most people really find it hard to get-into as compared to golang, I really love golang for its simplicity but I wish to tinker with rust too, so if Lisette combines both of these things and atleast makes me familiar with more rust without having to jump into too many hoops

reply
phplovesong 4 hours ago
Go has an awesome runtime, but at the same time has a very limited typesystem, and is missing features like exhaustive pattern matching, adts and uninitted values in structs.

Lisette brings you the best of both worlds.

reply
kubb 2 hours ago
Oh look, a better syntax than the Go team could design!
reply
Comma2976 2 hours ago
Nuh uh
reply
weiyong1024 2 hours ago
[dead]
reply