GitHub

Image from the site

Borgo is a new programming language that compiles to Go.

use fmt

enum NetworkState<T> {
    Loading,
    Failed(int),
    Success(T),
}

struct Response {
    title: string,
    duration: int,
}

fn main() {
    let res = Response {
        title: "Hello world",
       duration: 0,
    }

    let state = NetworkState.Success(res)

    let msg = match state {
        NetworkState.Loading => "still loading",
        NetworkState.Failed(code) => fmt.Sprintf("Got error code: %d", code),
        NetworkState.Success(res) => res.title,
    }

    fmt.Println(msg)
}
  • @KindaABigDyl
    link
    0
    edit-2
    5 months ago

    Neat. This might be the Zig killer ngl

    I like Rust and use it for most of my projects these days, but I also love the simplicity of C.

    I don’t love everything about Go, and I hated Zig when I used it, maybe this is the in-between that I need. I suppose it’s still garbage collected tho.