Last minute note: if you want to rebuild the compiler from
sources (and not only install it), in addition to nemerle-0.2.0.tar.gz
you will also need nemerle-keys-0.2.0.tar.gz. This is due an error in the
release process.
This version makes the Nemerle language full CLS consumer and producer.
A number of non-CLS features are also in place, for C# compatibility,
but we do not yet support CLSCompliant attribute checking. Any lack
in CLS compliance is a bug now.
The language:
- Multidimensional arrays are now supported. This features was
implemented by Ricardo Fernandez Pascual. The syntax for array
types is: array <3, int> for three-dimensional int array (int[,,]).
array <2> [[1, 2], [2, 3]] and array (2, 2) can be used for array
object construction.
-
Fields can be now embedded in properties:
public Foo : int {
mutable foo : int;
set { foo = value; }
get { foo }
}
They are invisible outside the property.
-
base.foo() and base.foo now work properly.
-
Attribute targets (like [assembly: ]) are now supported. This finishes
custom attributes support.
- @"foo""bar" works now as described (as in C#, that is "foo\"bar"). Patch
by Scott Fleckenstein.
- The () can be now omitted in (foo :> int) and (foo : int).
-
A typecase:
match (foo ()) {
| x : SomeType => x.field_of_sometype
| x : SomeOtherType => ...
| x : object => // always matches
}
The `:' pattern can be also used inside other patterns:
match (foo ()) {
| [x : Foo] => ..
| _ => ..
}
The `is' operator, known from C# has also been added.
- The `matches' operator has been added for one case matching:
expr matches pattern ==
match (expr) { pattern => true | _ => false }
It is to be reconsidered, if `is' can be used for both purposes.
- The `volatile' modifier is now respected and supported.
- checked/unchecked are now supported, as seen in C#.
- Other instance ctors can be now called from current ctor, using
'this(...)' syntax.
- Delegates can be now produced.
- Structs (classes that are value types, i.e. they are passed by
value) are now supported. Tuple2 and Tuple3 internal types are now
structs for efficiency.
- Varargs functions (using `params' keyword, before array argument)
are now supported.
- All value objects have now implicit parameterless constructor,
like in C#.
- Usage of the `<-' operator (where `=' should be used) now generates
a warning. It will be removed in a release or two.
- The implicit constructor for value types can now be used. For example:
def x = int ();
def y = SDL_Event ();
- Indexers can be now defined. Non-default indexers can be now
referenced.
public Item [x : int] : string { get { item [x] } }
public FooBar [x : int, y : string] : int {
get { foo (x, y) }
set { set_foo (x, y, value) }
}
The default indexer is always called `Item' currently. It can be
accessed using x[3] as well as x.Item[3].
- Enums can now be declared with expressions as values.
- An implicit empty class ctor is now added as in C#.
- `namespace X = G.D;' is now `using X = G.D;' (as in C#). The former
form usage generates a warning.
- New cool string interpolation feature -- the `$' operator is now
shorthand to Nemerle.IO.sprint, example usage:
def x = 40;
def y = 42;
System.Console.Write ($ "$(x + 2) == $y\n")
Any expression can be used in $(...), but there might be problems
with embedded strings and so on. It is meant to be used with simple
expressions like array/field access, method call and so on.
- The `==' has no fallback to reference equality now. This means, that
if a class and its base classes have no overload for the `=='
operator, then using `==' on it is an error. There are two
exceptions: if (at least) one side of the `==' operator is
(exactly) of the System.Object type, or one side of the `=='
is the null literal, then reference equality is checked.
A few bugs in the compiler was pointed out by this (more restrictive
then in C#) feature. The same goes for the `!=' operator.
All that means, that given:
class A { }
class B : A {
public static @== (_ : B, _ : B) : bool { true }
}
The following is OK:
(A () : object) == (A () : object) // false
(A () : object) == A () // false
A () == null // false
(null : A) == null // true
B () == B () // true
B () == null // true
(B () : object) == null // false
(B () : object) == (B () : object) // false
And the following are errors:
A () == A ()
A () == (null : A) // (null : A) is not null literal
(B () : A) == (B () : A)
The library:
- Bugfixes in queue implementation.
- Nemerle.Utility.Pair module added, with 3 little functions.
- The foreach() macro is now optimized when used on arrays and lists.
- Lots of reworking and rewrites, particularly introducing properties
instead of methods here and there.
The compiler:
- The KeyFile, AssemblyName and Version attributes are now supported, with
their special semantic meaning derived from C#.
- -r option can now load assemblies from the GAC by strong name.
- Nemerle assemblies can now be stored in the GAC, make install uses
gacutil now. Beware of make boot problems, when the same version of
Nemerle is installed in the GAC. Mono 1.0 is now required under Unix.
- Fixes in constant loading, particularly decimals.
- Using the obsolete `<-' assignment operator triggers now a warning.
- New -resource and -linkresource switches for embedding/linking
resources into executables.
- Lots of other bugfixes.
Other stuff:
- Sioux has been extended, generalized and documented.
- CodeDomProvider for Nemerle has been submitted by Atsushi Enomoto.
There is some preliminary work on XSP supporting Nemerle ASP.NET pages.
- Async methods macros have been written by Ricardo Fernandez Pascual.