Java Magazine, March/April 2016
ORACLE COM JAVAMAGAZINE MARCH APRIL 2016 54 jvm languages I started writing what would become the Golo programming language in the summer of 2012 I was working on dynamic software modifications with my research colleagues and we had proposed a JVM agent called JooFlux to inject changes and aspects into Java programs on the fly It was based on JSR 292 support for dynamic languages on the JVM and the invokedynamic bytecode instruction I ended up experimenting a lot with this bytecode trying to facilitate the design of dynamically typed languages on top of the JVM As I studied existing JVM languages that lacked invoke dynamic I thought it would be a good idea to create a language that has simple and easy to understand compiler and runtime codebases to enable experimenting with language advances such as new bytecodes Fast forward a few years and Golo is now an incubating Eclipse Technology project where hobbyists who have no prior language development experience contribute to its development and research derivatives have been based on it This article provides a tour of some of the features of the Golo programming language It does not cover all the features yet it should give you a good start A Verbose Start Golo is a dynamically typed language It supports imperative and functional idioms and it integrates nicely with Java To illustrate that let me start with a simple program that creates a java util ArrayList from the Java standard APIs and then iterates over the elements to print them The constructions are deliberately close to what you would write in Java but I will soon show how to make them more concise module javamag Hello import java util A comment function main args let elements ArrayList elements add Hello elements add world elements add let size elements size for var i 0 i size i i 1 print elements get i if i size 1 print println The code above demonstrates a few things The code is a module which is the compilation unit in Golo import statements help resolve symbols Function parameters are passed between pipe symbols There is no new operator for creating instances of Java classes instead the constructors are called as functions let defines constant references and var defines variable references Instance methods are called using the operator as in JULIEN PONGE PHOTOGRAPH BY MATT BOSTOCK GETTY IMAGES Golo A fast low ceremony easy to learn language for the JVM
You must have JavaScript enabled to view digital editions.