6 ms·
I've wondered what it would be like to write a thin language that compiles to Go and mainly serves to introduce a reasonable type system on top, while benefitti
by brundolf 5y ago
I've wondered what it would be like to write a thin language that compiles to Go and mainly serves to introduce a reasonable type system on top, while benefitting from its performance and garbage-collection. Could prevent null dereferencing, among other things
- hardwaregeek 5y agoLike a TypeScript for Go? We could call it Tolang.
- brundolf 5y agoThat's the idea! I use Rust for a lot of personal projects mainly because of the type system, not because it doesn't have GC. I think GC's totally livable for a great many things, and it would help iteration speed a lot to not have to deal with the borrow-checker, but I just can't stand working in a language with a shaky type system these days. So Go-with-good-types sounds fantastic to me.
- smabie 5y agoHow about OCaml?
- brundolf 5y agoI've heard the tooling and general ecosystem are not great (similar to Haskell), though I don't know firsthand
- ggu 5y ago+1 After learning OCaml & experiencing algebraic data types and pattern matching, writing in other languages just makes me want to switch to OCaml
- scns 5y agoOCaml will be a viable alternative when multithreading works, hopefully soon.
- scns 5y agoOr Kotlin, KOlang.
- jacques_chester 5y agoI think your difficulty would be in finding interested users. People who like Go, like Go, warts and all. Everyone else has heaved a sigh of relief and decamped to other languages.
- brundolf 5y agoTo be clear, I'm not suggesting that I personally would be able to bootstrap this (and the tooling, and the declarations for existing libraries, etc) and have it take off But if I saw it pop up on HN I'd jump on board in a heartbeat Go has a lot of compelling benefits around compiling, performance, concurrency, etc that I think would translate. It just made a couple of really unfortunate decisions around null pointers and default values that turn a lot of people off. I think salvaging it from those unfortunate decisions would be worth doing for the right party with the resources to do so, and I think it would appeal to a lot of people I'm not even sure I would want generics to be added, since that's an elephant in this particular room. I just want to be able to have a mote of confidence in the values I'm working with.
- noisy_boy 5y agoI wrote one component in go - it does everything that is expected from it with good performance without having to deal with virtualenv/jvm dependencies. However I don't want to write that much code again. Only of there was a language with ecosystem/brevity/garbage collection of Java, strong type system/pattern matching of Rust, excellent multi-threading of go and produced a dependency free binary.
- still_grokking 5y agoScala Native probably. But I've never used it so not sure how mature it is. https://scala-native.org/ https://scala-native.org/ The other Go alternative I see is D. Close to the metal but with high level features. Runs in a managed runtime. Creates native code. https://dlang.org/ https://dlang.org/
- noisy_boy 5y agoThanks for reminding me about D - I've always heard about it but never checked it out. Will try it out to see how it feels.
- pjmlp 5y agoBe prepared that D kind of struggles with having a small community, other than that, it is a very nice C# like language with systems programming capabilities and AOT compilation.
- pjmlp 5y agoD is more than that, think of C# as version 1.0 should have been all along.
- nemo1618 5y agoIt is super weird to me that no big compile-to-Go languages have emerged. It doesn't seem like anyone is even trying! Why not?
- jmnicolas 5y ago> Why not? Why? What would be the point except as a personal challenge?
- Zababa 5y agoMost criticisms of Go could be adressed by a language with a Hindley-Milner type system: https://go.dev/blog/survey2020/missing_features.svg https://go.dev/blog/survey2020/missing_features.svg from https://go.dev/blog/survey2020-results https://go.dev/blog/survey2020-results. Having a ML-like that compiles to Go could solve all those issues, while still keeping the great ecosystem that Go managed to build. Just like with Scala, this new language could allow people to see if that's what they really want, and offers to the Go team possibilities of evolution without the need to commit completly to them.
- pjmlp 5y agoFor that I already have OCaml, Haskell and F#, so why bother?
- Zababa 5y agoOCaml and Haskell don't have Go's ecosystem in terms of quantity. For F#, can it be compile to a binary like Go? I searched for a bit and couldn't find a good answer. Another thing is that people like to stay in their ecosystems. If you already have a large codebase in Go, internal libraries, etc, switching could be difficult.
- pjmlp 5y agoQuantity isn't a synonym for quality. There are a couple of ways to compile .NET code into native code. Since version 1.0 NGEN was part of the SDK, although its main purpose was faster startup with dynamic linking. On Microsoft side there has been CoreRT, NativeAOT, .NET Native. Mono has had AOT support since ages and it is anyway required for iOS deployments. Other than that several community efforts have taken place as well, for example WebAssembly. https://fsbolero.io/ https://fsbolero.io/
- dzonga 5y agov-lang ? https://vlang.io/ https://vlang.io/
- benhoyt 5y agoI suspect in part it's a combination of 1) Go is good enough as is (and some people don't mind Go's simple type system or the boilerplate-y but explicit error handling), and 2) the Go tooling is really good -- "go build", "go test", etc, would all have to be wrapped or rewritten with slower, buggier versions.
- HALtheWise 5y agoLong ago I hacked together a weekend project with a friend of "JSX for go" that allowed embedding html tags into Go source like people do for react. We were pleasantly surprised how readable and flexible the Go parser source code was, even for the pretty dramatically different syntax we were trying to support. https://github.com/8byt/gox https://github.com/8byt/gox