Bali is an alternative language for the JVM that shares Java semantics but with a better syntax. The name comes from the small island right to the east of Java.
Ok, Bali isn’t a programming language, at least it is not an existing programming language. It is only a desire of a Java programmer that fell in love with Scala in his middle age crisis.
At the beggining Java was great, you didn’t have to take care of the memory, the API was very complete and documented, it ran unmodified in different environments and the tools were good… But time passes and you start seeing other languages in a different way.
Java is not as appealing as she was when she was young. Of course she is now more mature and has improved over the years (generics, enums and lambdas are good proofs), but others start to catch your eye.
The problem is that you shared a lot of things with Java, you planned your future with her and you know her deep inside. You don’t want to throw all that to the thrash can and start from scratch again!
Anyway, the thrill of trying new things is hard and you start flirting with other languages. Scala, Groovy, Ruby, Python but most of them are dynamic (with its good things, and bad things) so they don’t completely replace Java.
Oracle should be aware that a lot of developers consider changing language (not platform) because it evolves slow and it is very verbose (slow to develop with). But adapting Java is slow and should be done with care because there are a lot of code and tools to support.
They could avoid that situation creating a new programming language which shares the same Java semantics but more appealing to develop with.
If they do, most of developers trying to find an alternative would consider their proposal (because we trust Oracle) so they keep platform control, and it will be less fragmented.
It is important to note that if Oracle itself develop this language, tool vendors and middleware developers would support it better than if it is developed by other company. Just because they are the owners of the Java Platform and this assures the new language will be supported properly.
No other JVM language has had a massive adoption yet (each of them for their own reasons) but if Oracle itself provides an alternative, lots of programmers looking for another language would take this option seriously.
These are the things I would value in this language:
Don’t rely on filesystem structure (directories and file names)
You end up with a lot of files and nested directories even for the smallest projects. Bali could support a flat package layout. This way you can start coding a package in a file, and split it in a directory only when it grows. Ie:
org.example.pack1/ // Allow the use directories with dots instead nested ones org.example.pack1.subpack/ org.example.pack2/ org.example.pack3.bali // Allow to use a file to hold all package classes
More than one public class per file
This point is related to the previous one. It will allow to start with a file and split it in different files when needed (no more twenty line classes in their own file)… My editor is gonna run out of tabs!
Getters and setters as fields
Allow to define
<Type> $name () and
void $name (<Type> newVal)
allowing methods with these patterns to be accessed as fields. This way you scale functionaly
not having to change client code (class users) if you change a field by a method or the
opposite. Ie: you can start with a final field and after that change that for a
pair without changing all clients. For example:
This feature would be very useful for writing JDBC queries or embedded XML. An example worths one thousand words:
Default and named params
Implementing this would save a lot of overloaded methods. It would also ease the creation of inmutable objects. And lastly, it could improve DSLs creation.
Remove semicolon whenever is possible
This one would improve readability and speed up editing. No need to say anymore :)
Last lambda outside parenthesis
For me it seems ugly to finish a sentence with
}); if you could end it with just
} it would
Add identity operator (
===) and use
== as equals
Having to write
equals always seemed too verbose for me. Creating another operator for
===) and using
== for equality would be more clear.
Null safe navigation operator (
Override (not define) operators
Another good feature of Groovy is operator overloading. this can enhance the
code readability. On the opposite, you have Scala’s operator definition that can
lead to a mess if programmers are careless. Ie: you can define the
*/+- operator if you want.
Markdown in Javadoc
This way it would be easier to maintain the code documented ;)
With these changes, the language would be compatible and would be an evolution, not a revolution to Java. This language could be a proving ground to test new additions to Java.
I was a one programming language man until now, I cheated Java with Scala and Groovy. Anyway among all languages you have for the JVM, none of them are just a faster (to write programs) Java.
And you, what improvements would you do to the Java language?