Have is a new programming language that transpiles to Go. It shares a lot with Go, the Go type system is a subset of the Have one, and libraries written in Go should feel natural to use in Have. Code written in Have should be accessible from Go too, in a way that is as elegant as possible (though not always idiomatic).

The project is still in its early stages.

You can find more information on the blog.

"Hello, world!"

Go

func main() {
    print("Hello, world!")
}

Have

func main() {
    print("Hello, world!")
}

Structures

Go

type Person struct {
    FirstName, LastName string
    Age                 int
}

func (p *Person) SayHi() {
    fmt.Println("Hi, I'm " + p.FirstName)
}

Have

struct Person {
    FirstName, LastName string
    Age                 int
    
    func *SayHi() {
        fmt.Println("Hi, I'm " + self.FirstName)
    }
}

Generics

Go

func MaxInt(a, b int) int {
    if a > b {
        return a
    }
    return b
}

func MaxString(a, b string) string {
    if a > b {
        return a
    }
    return b
}

func main() {
    print(MaxInt(100, 200))
    print(MaxString("hare", "rabbit"))
}

Have

func Max[T](a, b T) T {
    if a > b {
        return a
    }
    return b
}

func main() {
    print(Max(100, 200))
    print(Max("hare", "rabbit"))
}