New language expands on Google's Go

The Have project uses Go's toolchain, but sports a different syntax and makes key additions to the language

New language expands on Google's Go

One sure sign your language is successful: When people build other languages that transpile into it. JavaScript remains the prime example, but Google's Go language is shaping up to be a contender.

Previously, a language named Oden worked with Go's toolchain to add features that Go didn't support. Now Polish developer Marcin Wrochniak has introduced Have, a language that transpiles to and expands on Go.

In the blog post that introduces the project to Go developers, Wrochniak describes Have as a hobby project, with the goal of becoming a "companion" to Go that addresses some of its common "landmines."

The most obvious difference with Have is the formatting. Go uses curly braces in the manner of C/C++, while Have uses block indents, like Python. Non-Python users often balk at Python's space-sensitive syntax, but it's stood that language in good stead; up-and-comers like Nim have adopted it as well.

Other differences address idiosyncrasies in Go that give pause to novice and expert programmers alike. The way that variable declaration, structs, and interfaces work have all been modified in Have to be more consistent with each other and to avoid internal inconsistencies that Wrochniak feels are a common source of bugs.

Have also plans to add generics to Go --  a feature that Go's developers have staunchly refused to fold in for simplicity. Found in C++ and other languages, generics allow the programmer to create constructs in the language that use type parameters and make it possible to extend Have in ways not readily possible in Go. Have has some restrictions on how generics can be used, but since the language is still in the early stages, "the rules aren't final and can change in the future."

Along with generics comes "specializations," which let generics in Have use different code based on the type in question. Wrochniak gives an example where a byte-copying function can perform different varieties of copy operations depending on whether the source is a file stream or a slice.

Some complaints commonly associated with Go aren't being addressed in Have -- yet. Error handling in Go, for instance, has been criticized as requiring cumbersome boilerplate code. Have doesn't change Go's error-handling mechanisms, although a couple of proposed changes will ease the awkwardness in dealing with the values returned by the standard error-handling pattern.

As with any language in its early stages, Have is still highly experimental. Many of the features Wrochniak wants to provide haven't been implemented yet. But what stands out is Go's role as a platform for language innovation, not simply an environment for application development.

From CIO: 8 Free Online Courses to Grow Your Tech Skills
Notice to our Readers
We're now using social media to take your comments and feedback. Learn more about this here.