Expressions

PIL essentially has only very few types of expressions.

Literals

PIL's literals adhere very much to Java, except that no unicode characters can be used in PIL source code.

    String s = "a string";
    Float f = 1.0;
    Char c = 'a';
    Long l = 1000000l;
    Int i = 20;
    Bool b = true;
    Object o = null;

Method calls

Similar to Scala, operators in PIL are just syntactic sugar for method calls. The following are equivalent, adhering to the typical precedence rules:

    2 + 2 * 4
    2.+(2).*(4)

Of course, normal method calls are performed as follows:

    o.someMethod()

Type conversion/casting

PIL's casting mechanism can also be used as way to do type conversion. Rather than using Java's, rather annoying, (OtherType)expression syntax, PIL uses a method call-style syntax, inspired by Scala. However, casts can be overloaded, so you can do things like this:

    Object o = 8;
    Int i = o.as<Int>; // casts to Int
    String s = i.as<String>; // converts to String

Class instantiation

    new SomeClass()