Permalink
Nice Programming Language 0.9.9 released
22 SEP 2004
Version 0.9.9 of the Nice Programming Language compiler is now available. You can download it from this page. Changes in this version include:
* Assertions about the type of variables are used by the typechecker, so that
casts are not necessary. For instance:
Object o = ...;
// We happen to know by design than the object must be a string
assert o instanceof String;
// Here o can be used as a string without cast
The same construct can be used with '!= null' tests.
* java.lang.Class is now parameterized by the type it represents.
In particular, newInstance is now declared in nice.lang with
T newInstance(Class);
This make it possible to write type-safe code that uses reflexion,
in particular when using class literals.
* Subclasses can have less type parameters than their parent by fixing
the value of the others. For instance:
class BitField implements List { ... }
* Improved speed of coverage tests for some methods.
* Much improved nicedoc tool.
* Removed the '--strict' compiler option.
* Underscores are allowed and ignored in literal numbers. example:
long x = 1_000_123_000_456;
* The indexing operator supports multiple arguments now. For instance
'a[x,y]' is syntactic sugar for 'a.get(x,y)'.
* Lists now support a wide array of slicing and indexing
operations. There is a new bit of syntax, '@', which indicates
the index of the last item in a list, which can be used for working
with indexes relative to the end of the list, instead of the beginning.
For instance, given a list of ints from 0 to 6 called
'intList':
intList[@] is 6,
intList[@-1] is 5,
intList[1..2] is the list [1,2].
intList[1..@-1] is a list of all but the first and last
elements of ints, i.e., [1,2,3,4,5]
intList[1..] is a list of all but the first element of intList
intList[..] is a complete copy of intList
intList[..@-1] is a list of all but the last element of intList
intList[int i => i % 2 == 0] is a list of all the even ints
in intList: [0,2,4,6]
Several more options are available, an update to the manual will
reflect this.
