Posted by Colin on April 26, 2010
Over the past few months I have been working on a new programming language for the JVM. It’s called Gleam and its purpose is to make view layer programming for web applications easier.
You can read more on the approach taken and the problems it is trying to solve here and here.
I have created a site for Gleam (written using Gleam) and it is located at http://www.gleam-lang.com.
The source for Gleam is on github at http://github.com/gleam. The compiler is written in Scala and is gradually getting completely rewritten now that I’ve firmed up the design (read: I’m not proud of the code itself, just what it does).
So, without any further ado, have a play!
Feedback
I’d love to hear any feedback or questions on this! Please comment, twitter, e-mail me and I’ll get back to you :)
Posted by Colin on April 26, 2010
Following a discussion over on David MacIver’s blog. I have a piece of functionality I’d like to see in more languages.
The ability to easily add information to exceptions
try {
// ...
} catch (Exception e) {
e.addInformation("serverName", serverName);
throw e;
}
Or, even better, a way to annotate variables to get this for free/cheap:
@PutInExceptions String serverName = config.getServerName;
The advantage of being able to add this information is that it makes it easier to diagnose exceptions without losing the type of the exception. Often, when we see an exception we get a full stack trace telling us the line that caused it but not enough surrounding information to make replication easy. Consider the following:
public User getUserDetails(int id) {
if (!cache.contains(User.class, id)) {
// Populate the cache
}
User user = cache.get(User.class, id);
log("Got user with name ["+user.getName()+"]");
return user;
}
If this blows up on the log line then all we know is that user is null. We don’t know the id that was used. This can make debugging harder.
Having the ability to annotate things as “add this to any exception that occurs” makes it easy and cheap to get good error handling. If you then want a method to be ultra-fast then you don’t add the annotations – simple.