TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Borgo is a statically typed language that compiles to Go

666 pointsby manxabout 1 year ago

42 comments

tbrockmanabout 1 year ago
This addresses pretty much all of my least favorite things with writing Go code at work, and I hope--at the very least--the overwhelming positivity (by HN standards -- even considering the typical Rust bias!) of the responses inspires Go maintainers to consider&#x2F;prioritize some of these features, or renews the authors interest in working on the project (as some have commented, it seems to have gone without activity for a little bit over half a year).<p>Some of the design decisions seem to me to be a bit more driven by being Rust-like than addressing Go&#x27;s thorns though. In particular, using `impl` to define methods on types (<a href="https:&#x2F;&#x2F;borgo-lang.github.io&#x2F;#methods" rel="nofollow">https:&#x2F;&#x2F;borgo-lang.github.io&#x2F;#methods</a>), the new syntax for channels and goroutines (<a href="https:&#x2F;&#x2F;borgo-lang.github.io&#x2F;#channels" rel="nofollow">https:&#x2F;&#x2F;borgo-lang.github.io&#x2F;#channels</a>), and the `zeroValue()` built-in (<a href="https:&#x2F;&#x2F;borgo-lang.github.io&#x2F;#zero-values-and-nil" rel="nofollow">https:&#x2F;&#x2F;borgo-lang.github.io&#x2F;#zero-values-and-nil</a>) seem a bit out of place. Overall though, if I had a choice, I would still rather write Borgo by the looks of it.
评论 #40219198 未加载
评论 #40224883 未加载
评论 #40227546 未加载
lordofgibbonsabout 1 year ago
Wow, this is everything I want from a new Go!<p>Having worked on multiple very large Go codebases with many engineers, the lack of actual enums and a built-in optional type instead of nil drive me crazy.<p>I think I&#x27;m in love.<p>Edit: Looks like last commit was 7 months ago. Was this abandoned, or considered feature complete? I hope it&#x27;s not abandoned!
评论 #40217033 未加载
评论 #40216208 未加载
Hasnepabout 1 year ago
About a year ago, I tried writing a language that transpiled to Go with many of the same features, in my research I found other attempts at the same idea:<p>- braid: <a href="https:&#x2F;&#x2F;github.com&#x2F;joshsharp&#x2F;braid">https:&#x2F;&#x2F;github.com&#x2F;joshsharp&#x2F;braid</a><p>- have: <a href="https:&#x2F;&#x2F;github.com&#x2F;vrok&#x2F;have">https:&#x2F;&#x2F;github.com&#x2F;vrok&#x2F;have</a><p>- oden: <a href="https:&#x2F;&#x2F;oden-lang.github.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;oden-lang.github.io&#x2F;</a>
评论 #40242526 未加载
throwaway17_17about 1 year ago
I am genuinely appreciative that a post like this, a GitHub link to a semi-slow moving, but clearly well considered and sincerely developed programming language, can not only remain on the front page of HN, but can generate a diverse and interesting group of discussions. It’s material like this that keeps me coming back to the site. I’m not sure if anyone needed this comment, but I’m sure my posting it isn’t going to hurt.
评论 #40221337 未加载
raleghabout 1 year ago
Great! Something I&#x27;ve always wanted.<p>I&#x27;d love to be able to use a bit more type-y Go such as Borgo, and have a Pythonesque dynamic scripting language that latches onto it effortlessly.<p>Dynamic typing is great for exploratory work, whether that&#x27;s ML research or developing new features for a web app. But it would be great to be able to morph it over time into a more specified strongly typed language without having to refactor loads of stuff.<p>Like building out of clay and firing the parts you are happy with.<p>Could even have a three step - Python-esque -&gt; Go&#x2F;Java-esque -&gt; Rust&#x2F;C++esque.
评论 #40213383 未加载
评论 #40215572 未加载
评论 #40213362 未加载
评论 #40213392 未加载
评论 #40219196 未加载
DerSaidinabout 1 year ago
I like the graph at the top of the readme as a summary.<p>The rest of the readme focuses on the delta between Go and Borgo. It doesn&#x27;t say much about the delta between Borgo and Rust.<p>I think the delta there is mainly no lifetimes&#x2F;ownership?
评论 #40215137 未加载
giovannibonettiabout 1 year ago
This seems to achieve a similar type safety&lt;-&gt;complexity tradeoff as Gleam [1] does. However, Gleam compiles to Erlang or JavaScript, which require a runtime and are not as performant as Go.<p>I wonder if Borgo&#x27;s compiler messages are as nice as Rust&#x27;s&#x2F;Gleam&#x27;s, though.<p>[1] <a href="https:&#x2F;&#x2F;gleam.run&#x2F;" rel="nofollow">https:&#x2F;&#x2F;gleam.run&#x2F;</a>
评论 #40214025 未加载
HippoBaroabout 1 year ago
Go has an amazing runtime and tool ecosystem, but I’ve always missed a little bit more type safety (especially rust enums). Neat!
preommrabout 1 year ago
This and pub&#x2F;private modifiers for structs instead of letter casing is all I&#x27;ve ever wanted.
评论 #40213585 未加载
评论 #40219047 未加载
shepherdjerredabout 1 year ago
I would kill for these languages features in Go
评论 #40215389 未加载
owenpalmerabout 1 year ago
This looks like an interesting sweet spot. Rust is often praised for the borrow checker, but honestly I really only like rust for the type system and error handling. Go is praised for it&#x27;s simplicity, but hated for it&#x27;s error handling.
评论 #40219452 未加载
评论 #40221390 未加载
eximiusabout 1 year ago
Be still my heart. I would use this so fast at work where we currently use Go.<p>But introducing a new language is a scary thing.
littlestymaarabout 1 year ago
<i>Many people on HN</i> “Rust syntax is so ugly”<p><i>rustaceans</i> “I love the Rust syntax so much I want it in Go too”
评论 #40213723 未加载
评论 #40217965 未加载
lf-nonabout 1 year ago
In the same vein, Go+ is also interesting, and its being actively developed.<p><a href="https:&#x2F;&#x2F;goplus.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;goplus.org&#x2F;</a>
评论 #40235977 未加载
metadatabout 1 year ago
Is it correct to say Borgo &quot;compiles to Go&quot;, or should it say &quot;transpiles to Go&quot;<p>It appears to be a transpiler (consumes a Borgo and does the work to convert and emit a Go program as text):<p><a href="https:&#x2F;&#x2F;github.com&#x2F;borgo-lang&#x2F;borgo&#x2F;blob&#x2F;main&#x2F;compiler&#x2F;src&#x2F;codegen.rs">https:&#x2F;&#x2F;github.com&#x2F;borgo-lang&#x2F;borgo&#x2F;blob&#x2F;main&#x2F;compiler&#x2F;src&#x2F;c...</a>
评论 #40212642 未加载
评论 #40212528 未加载
评论 #40212616 未加载
评论 #40212590 未加载
评论 #40212608 未加载
Qerubabout 1 year ago
Reminds me of this previous effort to build upon Go but add a more flexible type system: <a href="https:&#x2F;&#x2F;github.com&#x2F;oden-lang&#x2F;oden">https:&#x2F;&#x2F;github.com&#x2F;oden-lang&#x2F;oden</a>
philosopher1234about 1 year ago
The only language I can think of that has pulled off “compiles to another totaling language” and gained mainstream adoption is typescript, and I’m sure it wouldn’t have done so if it were possible to run in the browser otherwise.<p>Can anyone think of another example?
评论 #40212812 未加载
评论 #40214780 未加载
评论 #40212771 未加载
评论 #40213196 未加载
评论 #40215215 未加载
评论 #40216736 未加载
评论 #40213627 未加载
评论 #40212729 未加载
评论 #40212762 未加载
templaedhelabout 1 year ago
They made a coffeescript for go
评论 #40212779 未加载
syngrog66about 1 year ago
I&#x27;d never let a rando project on GitHub generate my code. Become dependent on their tiny new syntax AND let it generate the Go code that will actually be built from. Asking for things like backdoor insertion trick to be introduced later, after they have enough folks dependent on them and decide reward worth the risk. GitHub is The Jungle and all that entails.
tail_exchangeabout 1 year ago
Option instead of nil is amazing. Imo, the biggest flaw in Go&#x27;s design is having nils instead of optionals.<p>I don&#x27;t have a strong opinion on Result and Pattern matching - it seems nice, but I don&#x27;t know if it adds much to the language. It is nice, but it may not be worth the complexity.<p>The error handling with ? is a no for me. I&#x27;d rather have something more like the go-errors&#x2F;errors package in the standard library instead. This has been proposed before, and it was rejected for a good reason: it makes it too easy to be lazy and just bubble up errors instead of properly handling them.
cellularmitosisabout 1 year ago
Has anyone written a language which targets golang assembler yet? I’m surprised I don’t see that.
ackseqabout 1 year ago
to me the problem is not the language per se but the emerging complexity of a project written in a language. I.e. say I&#x27;m familiar with go and a k8s user. Does that mean that I can understand the architecture of k8s project and be meaningfully productive in a short period of time? Far from it.<p>Sometimes I think we focus too much and formalize on the first order tooling we use, language being one of them, while we neglect the layers upon layers of abstractions built on top of them. I wonder whether a meta-language could exist that would be useful in these upper layers. Not a framework that imposes its own logic. More of a DSL that can capture both business logic and architecture.
OJFordabout 1 year ago
Why compile to Go rather than less-than-ideal (or even slightly-unsafe) Rust?<p>I find it conceptually compelling, I&#x27;m just surprised the target would then be in the GC&#x27;d, larger-binary&#x27;d direction. Like &#x27;Java expressiveness with C simplicity, transpiles to Java&#x27;.<p>Perhaps &#x27;just&#x27; because it&#x27;s a lot simpler to just expand the target language slightly and then you only have to deal with mapping the new bits into implementation, it&#x27;s less like writing a compiler for a whole new language?
评论 #40217964 未加载
评论 #40218028 未加载
yencabulatorabout 1 year ago
Sum types having zero values seems to be breaking the promise that people hoped out of them.<p><pre><code> use fmt enum Coin { Penny, Nickel, Dime, Quarter, } fn wtf() -&gt; Coin { return zeroValue() } fn main() { let coin = wtf() fmt.Println(&quot;zero coin:&quot;, coin) } </code></pre> Output:<p><pre><code> zero coin: {0}</code></pre>
rdevsrexabout 1 year ago
It looks pretty interesting! Definitely something to play around with, but honestly, I&#x27;d rather just use Rust (or Gleam if GC is ok).
eklavyaabout 1 year ago
Congratulations and best wishes for your project. I have hoped for a Go+Rust lang for a long time now.
fl0kiabout 1 year ago
It&#x27;s a little suspicious the example uses math&#x2F;rand.Seed() which has been deprecated for over a year. That&#x27;s when I noticed the repo itself hasn&#x27;t had a single commit in 7 months.<p>Why is this suddenly news, when by all appearances it&#x27;s abandonware?
评论 #40215545 未加载
anonfordaysabout 1 year ago
This is a fantastic proof of concept project that answers a question I&#x27;ve been asking: what if there was another language that was designed to fit between Go and Rust? Ideas?
sevkihabout 1 year ago
So swift?
评论 #40218273 未加载
peterkosabout 1 year ago
This looks a lot like Swift. To me, that&#x27;s a good thing :)
jjnoakesabout 1 year ago
What&#x27;s the license?
fridentalabout 1 year ago
I understand that you like some Rust features like Result and Option types, enums, and pattern matching.<p>These features provide for more safety, and at the same time, they reduce productivity by forcing the developer to statically type everything.<p>The question is then why do we need to transpile to Go, a language with GC and slower than Rust?<p>If we already agree on super-safe static typing, why not just use Rust? Are there any libraries in Go that are not available or of worse quality in Rust?
pdimitarabout 1 year ago
Does Borgo have a Treesitter grammar? An LSP? I&#x27;d use it in a heartbeat if so.
评论 #40220883 未加载
rthnbgrredfabout 1 year ago
Would it be possible to make a Python (without C extensions) that compiles to Go?
评论 #40215185 未加载
评论 #40213711 未加载
dexwizabout 1 year ago
Can you use Go modules?
评论 #40218262 未加载
vbezhenarabout 1 year ago
No exceptions - no love.
rowanG077about 1 year ago
Why would you target Go?
评论 #40212567 未加载
评论 #40214360 未加载
评论 #40212569 未加载
outside1234about 1 year ago
Nice - it uses Rust Try syntax to solve error conditions and Rust style enums!<p>Which of course begs another question but I won&#x27;t be that Rust fanboy
nikolayasdf123about 1 year ago
if this produced SIMD optimised code, better inlining, and just more LLVM features, I would use this!
ThouYSabout 1 year ago
wow. this is it!
a3wabout 1 year ago
Go is less complex than rust? Really? I thought that was disputed.
评论 #40213394 未加载
评论 #40214390 未加载
评论 #40217969 未加载
ketralnisabout 1 year ago
Rust is not as complicated as the opening graphic indicates. I usually see this meme from less experienced people but I&#x27;m frankly surprised to see it from somebody that&#x27;s capable of writing a compiler <i>in rust</i>.
评论 #40213250 未加载
评论 #40213007 未加载
评论 #40214404 未加载
评论 #40218055 未加载