The Future of Kotlin (FoK) team has called an emergency meeting after the discovery of a new virus which is threatening to destroy all of their hard work. For those who don’t know, Kotlin is a new programming language for the JVM that aims to remove common headaches like null pointer exceptions and source code verbosity. It’s already seeing widespread usage in companies like Sound cloud, Pinterest and Coursera.
“We have reason to believe this virus is very dangerous”, says FoK team member Martin Novakovsky “It essentially rewrites your entire program so that it does not compile anymore.” “But there are no symptoms until you attempt to run it.” “After 9/11 we were all warned to look out for any other terrorists. But this is the first time we’ve been warned about a computer virus.”
The symptoms can be subtle, but may include:
- Programs which compile successfully but fail at runtime with no errors in either compilation or execution. Changes of compiler behaviour (non-compiling code previously compiled, extra errors when compiling code that previously compiled without error etc.) Lack of consensus on what language features are supported by different compilers. Programs which work in your IDEs but fail on build servers.
- Read Also: Avple
- “Of course it’s very hard to fix the Virus once you have it”, says Novakovsky “You can’t just delete all your files and start over again with clean copies because often times the files have been re-encoded and you no longer have the originals. So then you have to go into source control history and find out which commit introduced the Virus.” “Normally, we’re very careful about pushing code with bugs in it, but this time we didn’t know there was a problem until it was too late.”
- The team has already spent several days being tested for the virus at a clinic in Silicon Valley, but so far all results have come back negative. “I think they just send everyone who works on a compiler to their headquarters so they can monitor them closely”, says Novakovsky “In fact I wouldn’t be surprised if they knew about this virus before we did.”
- In an effort to combat the spread of the Virus, Kotlin has begun developing some new language features that may help. Among them is a more flexible type system and optional explicit returns:
- Fun foo(bar: String) {// explicit return not required here since we know the function only returns ‘unit’ on error} else if (error) throw Illegal Argument Exception(message)
- However, so far there has been no confirmation of whether these features will be included in future compiler releases or whether they represent an entirely different programming language. “We’re all just kind of waiting for this to blow over”, says Novakovsky “Thankfully we’ve got a great community and most people have already started using in 1.3 which doesn’t have any of these Virus features.” To know more check RemoteDBA.com
- When asked whether he thought the company should have done more to warn their own customers, Novakovsky said “People are always up in arms about something. If you don’t allow developers to make mistakes then they won’t be able to learn anything new. Of course it’s a difficult balancing act.”
- The FoK team is also considering reviving some older language releases which may have been less susceptible to the virus including M (j)ava 5/6/7 and Java 1.4. However, they will not consider reverting to an earlier version of Kotlin unless there is overwhelming community agreement that the infected codebase needs cleaning up by removing features introduced after its release.
- “At this point it’s hard to say. You can never trust your own code again once you’ve been attacked by the Virus”, says Novakovsky “But perhaps if we all band together, there’s hope for us yet.”
- We have reason to believe this virus is very dangerous. It essentially rewrites your entire program so that it does not compile anymore. But there are no symptoms until you attempt to run it. After 9/11 we were all warned to look out for any other terrorists. But this is the first time we’ve ever had to look out for our own code.
Conclusion:
Programming with Kotlin is just like normal Java Programming, but it’s much easier, better, and has more features while being secure by default. Any attempt to infect your Kotlin program will be caught at compile time by the compiler because it takes advantage of advanced static analysis capabilities in IntelliJ IDEA Ultimate Edition which are used to enforce policies for key security practices at compile-time. There’s no need to go through an additional step of testing or bundling other tools into your build process.