[.net] C# 3.0 Specification

Started by
34 comments, last by Arild Fines 18 years, 7 months ago
I'm not sure when this was released, but this page covers future versions of C#, and also has the C# 3.0 Language Specification. List of extensions from the overview page: • Implicitly typed local variables, which permit the type of local variables to be inferred from the expressions used to initialize them. • Extension methods, which make it possible to extend existing types and constructed types with additional methods. • Lambda expressions, an evolution of anonymous methods that provides improved type inference and conversions to both delegate types and expression trees. • Object initializers, which ease construction and initialization of objects. • Anonymous types, which are tuple types automatically inferred and created from object initializers. • Implicitly typed arrays, a form of array creation and initialization that infers the element type of the array from an array initializer. • Query expressions, which provide a language integrated syntax for queries that is similar to relational and hierarchical query languages such as SQL and XQuery. • Expression trees, which permit lambda expressions to be represented as data (expression trees) instead of as code (delegates). Any thoughts? The implicitly typed local variables sounds a lot like boo. Query expressions sound powerful, but... eh, SQL is quite ugly. Sorry, I had a bad experience in my database class :)

Advertisement
I think C# is on its way to evolve into a really great language. Are there any similar plans on the Java side, or are they content to be left behind?
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
Quote:Original post by mutex
Any thoughts? The implicitly typed local variables sounds a lot like boo.


Or VB's Dim x as New Integer :)
You can even download a preview compiler, *including* Visual Studio support: http://download.microsoft.com/download/4/7/0/4703eba2-78c4-4b09-8912-69f6c38d3a56/LINQ%20Preview.msi

Samples are pretty cool too:

    int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };    var lowNums =        from n in numbers        where n < 5        select n;



    List products = GetProductList();    List customers = GetCustomerList();        var productFirstChars =        from p in products        select p.ProductName[0];    var customerFirstChars =        from c in customers        select c.CompanyName[0];        var uniqueFirstChars = productFirstChars.Union(customerFirstChars);

var q =        from p in db.Products        select new {p.ProductID, HalfPrice = p.UnitPrice / 2};
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
wohoow! 2.0 isn't even out yet (at least with vs..), and i yet can't wait for the next version.. horray! :D

but indeed, it looks very cool. will provide quite some change on how to use the language over time, i'd guess..

i love the idea to express a lot of stuff in the app with searches.. finding all buttons that are part of the region, but are not the one i clicked, and disable them..

collecting all the values entered in the controls for "user info", and store them as xml, or online into a db, or what ever.

will be cool for dataloading definitely.. filters are definitely something lacking till now for "the big languages".

what i miss, though, is integration of c-omega style features.. then again, i've set up my multithreading components yet, and they, together with lamda expressions of 3.0, would definitely rock.. but c-omega would so, too...... :D:D:D:D
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

Quote:Original post by Arild Fines
I think C# is on its way to evolve into a really great language. Are there any similar plans on the Java side, or are they content to be left behind?


Sun is developing a new language named Fortress; however, I have no idea how it fits in the whole Java thing.

Contrary to Java, Fortress is packed with features (type inference, static checking of units (meters, seconds, ...), extensible syntax for domain specific languages, parametric types (on types as well as numbers), multiple dynamic dispatch, support for parallel execution, ...)
I must go against the tide here and say "wha?".

The class-extension feature and query stuff is cool but I don't really see much use for most of this.

Or maybe I'm just not seeing it well. What are some actual non-exemplary situations where I could use this stuff?
If you integrate querying into your toolkits and components, it can be very powerful.

For example, you can select all checked checkboxes out of a form, or you can select all mobs with hitpoints less than 1 out of some arbitrary mob collection.

Once the backing store for the querying is virtualized, moving mob storage from a linked list to a database table would be code transparent (but would have performance implications, of course :-)
enum Bool { True, False, FileNotFound };
Quote:Original post by SamLowry
Quote:Original post by Arild Fines
I think C# is on its way to evolve into a really great language. Are there any similar plans on the Java side, or are they content to be left behind?


Sun is developing a new language named Fortress; however, I have no idea how it fits in the whole Java thing.

Contrary to Java, Fortress is packed with features (type inference, static checking of units (meters, seconds, ...), extensible syntax for domain specific languages, parametric types (on types as well as numbers), multiple dynamic dispatch, support for parallel execution, ...)

offtopic: is Fortress a competitor to Fortran? i'm going by what i read briefly. Also, if Java were to make significant changes, wouldn't that break previous versions of Java. Everyone has been making it seem that way.

Beginner in Game Development?  Read here. And read here.

 

Quote:Original post by SOS
I must go against the tide here and say "wha?".

The class-extension feature and query stuff is cool but I don't really see much use for most of this.

In other words, you've never written an app that uses databases and/or XML? Or had the need to find a specific object in a collection, based on a set of custom criteria?

That makes you pretty... special...
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]

This topic is closed to new replies.

Advertisement