3 ms·
Rust has algebraic data types. That’s completely different than the proposed solution for Go, which is pretty much what Kotlin does. And IMHO its a bandaid. AD
by noncoml 8y ago
Rust has algebraic data types. That’s completely different than the proposed solution for Go, which is pretty much what Kotlin does. And IMHO its a bandaid.
ADTs are the way to go. If Go had ADTs I would pick it over Rust in a heartbeat, as I personally don’t care much about not having a GC, and think go-routines are superior to async/await.
- jillesvangurp 8y agoKotlin seems pretty nice. Been using it a lot lately. It's not perfect since you can still get into trouble but it forces you to opt in to that. You need to add a question mark to the type to indicate it is nullable and dereferencing without a null check is a compile error. You use two exclamation marks to bypass this to opt out of this. Of course if you are then wrong you may get npes. But it works well enough that you can write code pretty easily that simply cannot produce npes. Excluding that as source of bugs is nice and should be built into any new language.
- ZirconiumX 8y agoThis sounds like a fit for OCaml with either Async or preferably Lwt. ADTs are natural in OCaml, and you can even have Generalised ADTs which can encode ADTs into the type system. Granted, the main downside of OCaml is it still being single threaded. That can be worked around, but it depends on your workload.