Skip to content

CSharp 3.0 Features

Alex Zimin edited this page Sep 14, 2011 · 4 revisions

Table of Contents

Intro

Microsoft has released a specification for C# 3.0. We thought it would be funny to compare what they are planning with what we have already in Nemerle.

Implicitly typed local variables

This was in Nemerle since the very beginning. We however do not limit ourselves to the case when the type of initializer expression is known in detail (or to be precise, if known at all).

Extension methods

An issue reported in the tracker. They are already fully implemented.

Lambda expressions

Again, this was in Nemerle since the very beginning. The restrictions on parameter inference don't apply.

Object and collection initializers

We have the Record macro and named method parameters, though this seems somewhat nicer. Will have to investigate.

Anonymous types

Our tuples are more like tuples in math -- the fields don't have names, only numbers. It is an open issue which design is better.

We implement analog of C# Anonymous types as "new" macro. You can find it implementation here https://github.com/rsdn/nemerle/tree/master/macros/AnonymousClass.n.

Examples of using "new" macro you can find here:

https://github.com/rsdn/nemerle/tree/master/ncc/testsuite/positive/anonymous-classes.n

https://github.com/rsdn/nemerle/tree/master/ncc/testsuite/positive/anonymous-classes-lib.n

Implicitly typed arrays

No kidding.

Query expressions

This feature implemented as macro in "Linq" project (https://github.com/rsdn/nemerle/tree/master/Linq)

Expression trees

This seems like this is needed only for query expressions. Macros (and specifically quotations) are much more general and powerful mechanism.

This feature implemented as macro in "Linq" project (https://github.com/rsdn/nemerle/tree/master/Linq).

Clone this wiki locally