Joy - A new Go to JavaScript compiler

in programming •  2 years ago 

Joy is a new Go to JavaScript compiler that was released just about a week ago. It allows you to write client side websites with Go instead of JavaScript.

Bildschirmfoto 2017-12-13 um 09.10.31.png

(Author’s note: Interesting choice of imagery since the hot air balloon is very closely associated with the Smalltalk-80 programming language)

There is already GopherJS, but whereas GopherJS tries to compile existing Go applications to JavaScript, Joy takes a slightly different route by writing Go code specifically to be compiled to JavaScript. In that way Joy makes Go another transpiled to JavaScript language like CoffeeScript or TypeScript.

The resulting JavaScript is human readable and in most cases doesn’t need a runtime but instead compiles 1:1 to JavaScript, which means small code sizes. Go’s advanced static analysis features given to it by its type system allow Joy to eliminate dead code, just like it’s done in Google’s other programming language Dart, to further reduce code size.

Bildschirmfoto 2017-12-13 um 09.10.16.png

One goal of Joy is to make React and its smaller cousin Preact first class citizens, which should be very interesting if you are a fan of those popular frameworks.

Another interesting property of Joy is that it comes bundled with a headless Chrome browser already, so to run your tests and scripts you don’t need something like PhantomJS.

Joy is pre 1.0 right now, so there are still many rough edges and missing features, but it’s interesting to see where this will go. For better or worse (and the science on that is not at all settled yet), developers today are moving away from dynamically and gradually typed (sometimes referred to as optionally typed) languages towards statically typed languages, even for the web, so tools like Joy that let you use static types on the web are going to grow in popularity quickly. Since a lot of full stack web developers use Go already on the server side, using it for the client side too can be very powerful.

Personally I prefer other tools for web development like ClojureScript & Reagent which I’ve been using for Columns for Steem (a multi-column client for Steem, like Tweetdeck or Mastodon), but if you love the Go programming language the combination of Go & Joy might just be the right thing for you.

Here is a Hacker News thread about Joy if you want to see what other programmers have to say about it.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!