F3: New statically typed scripting language for java client development

Actually 3 new programming languages have been announced or released recently that deserve a look. Alfred Thompson discussed the recent release of Scratch, a graphical programming environment from MIT designed for kids. The Fortress programming language has finally released a working preview. Fortress, like Fortran, is designed with scientists in mind, and supports many innovative features such as scientific unit literals (think “x feet + y meters”). Lastly, below I cover some details about another new language that is due soon:

Chris Oliver has been working on F3 (“form follows function”), a new scripting language for the java platform. Here is a detailed description of F3’s features.

It is already in heavy development but not yet released, and there are plugins for both Netbeans and Eclipse. Some of its functionality and the examples Chris has shared indicate it could be an alternative to Flash and processing.

A summary of some of its features:

  • The syntax is very similar to java and javascript. It is case-sensitive and uses curly braces, for example.
  • It is statically typed with type inference (like boo). It uses “var” for type inferenced declarations (var x = 3;), like in groovy or C# 3.0.
  • It supports a JSON-like declarative syntax for building GUIs (as opposed to XML or YAML).
  • Has a “..” range literal: var result = sum([1,3..100]);
  • Supports SQL notation for querying arrays:
    var squares = select n*n from n in [1..100];
    //another example:
    var titleTracks =
                select indexof track + 1 from album in albums,
                          track in album.tracks
                              where track == album.title; // yields [1,4]
  • You can also embed the JSON-like syntax in code (or vice-versa):
            var chris = Person {
                 name: "Chris"
                 [Person {
                     name: "Dee"
                 Person {
                     name: "Candice"
  • Supports expressions inside strings:
    var answer = true;
    var s = "The answer is {if answer then "Yes" else "No"}";
    //The value of s is now: 'The answer is Yes'
  • Supports “do” or “do later” for code that either allows background events to occur or runs in a background thread itself:
            import java.lang.System;
            var saying1 = "Hello World!";
            var saying2 = "Goodbye Cruel World!";
            do later {
  • All methods and attributes of a class have to be declared first (like in C and C++, yay), and then the implementations are written outside the class body (like in nice).
  • Instead of constructors and setters, F3 uses “triggers”:
             import java.lang.System;
             class X {
                  attribute nums: Number*;
             trigger on new X {
                  insert [3,4] into this.nums;
             var x = new X();
             System.out.println(x.nums == [3,4]); // prints true

And one other feature that interested me the most is that Chris may possibly be using a MultiVM technique in F3, where different applications run in the same JVM instance, saving memory and improving start-up time, 2 things which even people in Sun say is an issue with Java on the client/desktop side. I would prefer that this technique be separated from F3 the scripting language, so that other languages (and java itself) could take advantage of it. That would make the java platform (and processing.org) a better competitor with Flash. On a side note, I’d love to see .NET/Mono support running applets in a browser, too, but that doesn’t look likely to happen anytime soon (although you can run .NET applications in Internet Explorer on Windows only).

Posted in development, programming

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 4,341 other followers

%d bloggers like this: