Live data from Hacker News

Borgo is a statically typed language that compiles to Go

github.com

171–180 of 559 posts

Re: Borgo is a statically typed language that compiles to Go

#171

I would kill for these languages features in Go

That's what C# offers (except true * Rust-style enums). The latter will be there in one of the future versions and is in an active design phase, which luckily focuses on tagged-union implementation strategy. With that said, you can already easily use one of the Option/Result libraries or write your own structure - switching on either is trivial (though you have to sometimes choose between zero-cost-ness and convenien…

It's not the best solution, but an analyzer like [0] covers most of the cases for reference types. For enums and struct DUs in general we'll have to wait for language (or even runtime) support.

[0] https://github.com/shuebner/ClosedTypeHierarchyDiagnosticSup...

Re: Borgo is a statically typed language that compiles to Go

#172
post #90
post #60

This and pub/private modifiers for structs instead of letter casing is all I've ever wanted.

I love Go's letter casing. It's such a neat way to remove cruft.

I like the terseness of it but having to refactor just because I change visibility is a bit stupid.

I never wrote ObjC but didn’t they use + and - (and nothing) as visibility modifiers?

Re: Borgo is a statically typed language that compiles to Go

#173

Earlier quoted context omitted.

JSON is just one tiny part of most programs, sitting on the edge where the program interacts with other programs; it doesn’t permeate the entire codebase. Structure privacy, OTOH, does. Count me in as someone who really enjoys the case-based approach. It’s not the only one which could work, but it does work.

The single most productive habit I picked up int the last few years is to always use exactly the same name for the same entity across source files, configs files, database entries, protocol fields, etc.

That’s funny, I did it your way for years and ended up considering it a big mistake.

Today I use idiomatic names - MyName in Go, myName in JS/JSON, my_name in SQL. There are many reasons but generally speaking, for me, it’s less effort and code is more readable.

Curious what your rationale is?

Re: Borgo is a statically typed language that compiles to Go

#174

Wow, this is everything I want from a new Go! 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. I think I'm in love. Edit: Looks like last commit was 7 months ago. Was this abandoned, or considered feature complete? I hope it's not abandoned!

An Enum type has to be on the core Go team's radar by now. It's got to be tied with a try/catch block in terms of requested features at this point (now that we have generics).

I've never needed either.

Try/catch is super confusing because the catch is often far away from the try. And in Python I just put try/catch around big chunks of code just in case for production.

I think Go is more stable and readable because they force you not to use the lazy unreadable way of error handling.

Enums I honestly never used in Go also not the not-type-safe ones.

But I'm also someone who used interfaces in Go maybe I think 4 times only in years and years of development.

I just never really need all those fancy things.

Re: Borgo is a statically typed language that compiles to Go

#175

Earlier quoted context omitted.

An Enum type has to be on the core Go team's radar by now. It's got to be tied with a try/catch block in terms of requested features at this point (now that we have generics).

The issue is that it's more or less impossible to graft onto the language now. You could add enums, but the main reason why people want them is to fix the error handling. You can't do this without fracturing the ecosystem.

> but the main reason why people want them is to fix the error handling

Why do you think so? Maybe I'm an odd case, but my main use case for enums is for APIs and database designs, where I want to lock down some field to a set of acceptable values and make sure anything else is a mistake. Or for state machines. Error handling is manageable without enums (but I love Option/Result types more than Go's error approach, especially with the ? operator).

Re: Borgo is a statically typed language that compiles to Go

#176

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. Can anyone think of another example?

I like your take but - not that this was important to TypeScript - JavaScript was literally the assembly language of the web (asm.js) until WASM came along. There was no other target that TypeScript could compile to. I guess that’s why TypeScript simply added types to JS, rather than being a wholly new language, which in turn made it compatible and familiar to potential adopters. It also solved a big problem caused by the growing size of client code bases.

All of that said - this train of thought lead me to discover AssemblyScript! https://www.assemblyscript.org/

Re: Borgo is a statically typed language that compiles to Go

#177

Earlier quoted context omitted.

It looks like something was lost in the middle of your comment. You open with something about it be objectively bad, but then it jumps to something about how it is subjectively bad. What was omitted?

How is "i cant name variables in my native language" subjective?

I don't really think the sarcastic tone was called for, but the previous poster is right. "I can't name variables in my native language" is objective, but whether or not that's bad is subjective.

Re: Borgo is a statically typed language that compiles to Go

#178

Earlier quoted context omitted.

> the majority of the reasons on why people make the distinction. You have provided some defining properties that might allow for distinction, but you have not given any reasons for why people make a distinction. But perhaps we can suss it out. Given the statement "Borgo compiles to Go", what important information is lost that would be saved if "Borgo transpiles to Go" was used instead?

In that statement, it doesn't really add anything. In the statement "XYZ is a compiler/transpiler", it does. It doesn't hurt to have a word that is more specific than others. Otherwise we should just refer to compilers as an "app" :)

> In the statement "XYZ is a compiler/transpiler", it does.

Okay. What important information is lost in "XYZ is a compiler" that would be gained in "XYZ is a transpiler"?

> It doesn't hurt to have a word that is more specific than others.

It can if the intent is not properly understood. And so far I'm not sure we do have that understanding.

Re: Borgo is a statically typed language that compiles to Go

#179

I would kill for these languages features in Go

That's what C# offers (except true * Rust-style enums). The latter will be there in one of the future versions and is in an active design phase, which luckily focuses on tagged-union implementation strategy. With that said, you can already easily use one of the Option/Result libraries or write your own structure - switching on either is trivial (though you have to sometimes choose between zero-cost-ness and convenien…

To clarify, my team uses Go and prefers to stick with "idiomatic" Go. So, while we could implement our own types, there would be pushback. As an example I liked lo [0] but my team was resistant because it's not considered idomatic.

If were up to me we'd be using a language with a better type system :)

[0]: https://github.com/samber/lo

Re: Borgo is a statically typed language that compiles to Go

#180

Earlier quoted context omitted.

I'm not sure why you included php in your list of examples of things that become bloated with dependencies. I've never seen that be the case.

Look at your list of built-in modules though :)

So stdlib counts as dependencies now?
Post reply on HN