C# 4.0 today!
You read about C#
3.0 and are willing to see how could C# 4.0 look like? More powerful
type inference? AST manipulation raised to its limits? Full generics support?
Try Nemerle!
In general
The biggest change in this version is switch to the .NET 2.0 assemblies.
The compiler now generates code using runtime generics when parametric
polymorphism is used in Nemerle. While the language was designed with this
switch in mind since the very beginning, the constantly changing and/or
incomplete specifications forced us to make several changes to language
semantics in this release.
The intention behind the 0.9 version number is that we're now very
close to the 1.0 stable release.
We now require either Mono 1.1.9 or MS .NET Aug 2005 CTP. There are still
several very serious issues with MS .NET S.R.E. API which may prevent certain
features from working. Under mono there are problems with generic type
serialization.
The performance of the generic code vary. Mono folks didn't
implement shared code yet, which means generic code is JITed for each
instantiation. This isn't that bad as it first look though, after
some tweaks that are already in the Mono 1.1.9 the performance is comparable
to the non-generic version.
In addition we should generate slightly better code overall with this
version. The changes are mostly cosmetic though.
There are some breaking changes in standard library API, because we dropped
our implementation of some generic classes in favor of .NET library classes.
Most previously existing classes are still available though, but they are now
subtypes of their BCL counterparts.
About 500 SVN commits was made since the last release.
Availability
As usual we provide a source code release and a number of binary packages.
Starting with this release we provide a single noarch RPM package
that should work with all architectures assuming mono is installed
in /usr. MSI package is ready, DEB package is on its way.
Warning:
Since 20:00
yesterday UTC till 11:00
today the 0.9.0 packages were broken. They
contained a wrong version of antlr.runtime.dll. This is now fixed.
For details consult the downloads
page.
Language changes
-
Function types are no longer covariant on return type and
contravariant on argument types. While in theory it is possible
to employ co/contravariant interfaces here, it doesn't work with
tuple subtyping (i.e. Func[int,string,float] is subtype of
Func[Tuple[int,string],float]). We have however provided implicit
conversion for it, so in some cases it will still work.
-
Type variables of the enclosing type are now visible in static
members (in addition to instance members). This also includes nested
types. This is implemented by copying type variables of the enclosing
type before type variables of the nested type. If you have:
class A[X] {
public class B[Y] { }
public clsas C { }
}
You can refer to A.B[int,string], A.C[int] as well as
A[int].B[string] and A[int].C. Inside A[X] you can also refer to
B[int] which means A[X].B[int] and to C which means A[X].C.
- The 'matches' keyword is no longer supported.
New features
-
Generic specifier -- you can specify parameters of:
- the generic type being created: Bar.[int] ();
- the generic type some static member is accessed from:
Bar[int].foo ();
-
the generic method: Bar.baz.[int] ();
- Missing variables in matching branches can be now specified:
match (some_list) {
// treat one element list as [x, x]
| [x] with y = x
| [x, y] => use x and y
// can also set several things at once:
| [] with (x = 7, y = 12)
// and mix with 'when'
| [x, _, z] when x == z with y = 17
| [x, y, _] => use x and y
| _ => ...
}
- Partial application on steroids. In ML you could apply two argument
function to a single argument and get another single argument
function. We now support a similar, yet more powerful, feature:
some_fun (e1, _, e2, _)
is transformed to
fun (x, y) { some_fun (e1, x, e2, y) }
Partial application can be therefore written as 'f (x, _)'.
It also works for member access:
_.foo
will be rewritten to:
fun (x) { x.foo }
The two rewrite rules can be combined -- _.foo (3, _) will result
in two argument function. Note that foo (3 + _) will probably not do
what's expected (it will pass a functional value to foo). Use plain
lambda expression for such cases.
- Default parameters for local functions. This is mostly useful for
accumulators, for example:
def rev (l, acc = []) {
match (l) {
| x :: xs => rev (xs, x :: acc)
| [] => acc
}
}
rev (l) // instead of rev (l, [])
as you can see the initial accumulator value is placed in a more
intuitive place. Any expression is valid as a default parameter value
for a local function, but beware that it is evaluated each time the
function is called without this parameter.
- #pragma warning:
#pragma warning disable 10003
some_unused_function () : void {}
#pragma warning restore 10003
You can also omit warning number to disable/enable all (numbered)
warnings. You can also specify several warning numbers separating
them by commas.
- Special implicit blocks are created around functions and loops.
After using Nemerle.Imperative; it is possible to use "break",
"continue" and "return". You can supply return value to "return",
much like in C.
More details at the blocks page.
Other stuff
- Alejandro Serrano is working on Code Completion Engine, that will be
used be various IDEs. For now he integrated some support for code
completion in nemish (try System.Console.Wri**<enter>).
- Kamil Stachowski provided syntax highlighting rules for Kate.
- Language fixes in documentation courtesy of Kenneth Ismert.
Bugfixes
- #156: Polymorphic type overloading does not work with dlls.
- #173: Resource Embedding
- #206: Apparent boxing bug in arrays
- #277: Switch to framework 2.0 with generics, bugfixes and so on
- #335: warning for $
- #345: polymorphic interface method implementation checking is broken
- #348: Members from current type are not accessible if looked up
through derived class
- #350: Generic and non-generic types with the same name should be
different
- #354: Private members of class should be accessible when we are
inside nested type of this class
- #359: Accessibility checks for protected types performed by bind_types
crashes compiler
- #369: typed macros queue
- #381: Problems with casting to 'a.
- #386: No special where-constraints: class, struct, new ()
- #388: type variables are not visible from nested classes
- #392: Null reference in generic code with ref parameters
- #417: Static members should be first class players in generics typing
- #423: the with ,,pattern''
- #430: make ++/-- properly flag overflows
- #435: Cannot use operators by their long names
- #446: Container objects should show their contents
- #450: Futile warnings when using Glade for Gui
- #461: block return expression cannot be used to leave try block
- #466: -disable-keyword compiler flag
- #474: make generic specifier work
- #475: add `42 kind of stuff to generic types in code generation
- #476: handle overloaded type names in binding types
- #478: self calls not properly detected
- #480: implement polymorphic local functions generation
- #481: list of voids causes ice
- #482: bug with delayed setter property typing
- #483: delayed typing fails after null comparison
- #484: ncc wrapper not available on linux system with binfmt_misc
- #485: virtual or abstract methods using type parm are not overridden
- #486: Problems with type inference on array elements
- #487: Double importation of interface creates a
System.NullReferenceException
- #488: I have no error - duplicate argument 'cx'
- #489: Use C#'s algorithm for searching members in classes - walking
through hierarchy
- #490: cannot unbox system.intptr
- #491: Change NemerleMethod to MethodBuilder
- #492: Cyclic generic types causes segfault
- #493: Overloading fails to choose delegate when it is created
implicitly
- #494: Elements initializing list are not properly boxed when list
unifies to list[object]
- #497: crazy error message for incompatible types in two control flow branches
- #498: parsing problem with matching
- #499: Internal compiler error
- #500: Wrong name type suffix used in macros/dataNpgsql.n with
mono 1.1.8.2
- #501: IsRegistered failed
- #502: invalid IL
- #504: default parameters for local functions
- #505: Variants should be not possible to inherit
- #506: Enums should allow only numeric types as base
- #507: interfaces sometimes confuse typer in case of foreach /
GetEnumerator usage
- #508: Property need to be marked public in order to use public get
and private set
- #509: Usage of 'array[2, int] * int' crashes the compiler
- #510: unable to build 0.3.2 on OSX
- #511: Unable to build nemerle trunk on OSX
- #512: In the testsuite, positive/basic-value-types.n won't compile
- #513: ** ERROR **: Invalid IL code at IL0007 in
_N_AutoModule:Main (): IL_0007: ret
- #514: true when () compiles
- #515: nemish prints an internal compiler error parsing a macro expansion
- #516: abort() doesn't work
- #517: nemerle fails to compile on OSX and Linux
- #519: Nemerle.Imperative.Return/Break
- #522: problem with string parsing
- #523: compiler throws internal compiler error typing my continuation
monad
- #525: problem with void->object conversions in nemish
- #526: List literals don't work inside generic classes
Best of the text i read about a problem.
We are wellocme to it's configuration.
Wellcome to the real world.
Hi! http://www.insurance-top.com/company/ car site insurance. auto site insurance, car site insurance, The autos insurance company. from website .
Need to be readed.
Your article is prety nice. It's a pity that i didn't see it more later.
Persone los pioneros non rabata. Great...
http://www.insurance-top.com/company/ car site insurance. The autos insurance company, compare car insurance, auto insurance. from website .