Jump to content
  • Advertisement
Sign in to follow this  
mutex

[.net] C# 3.0 Specification

This topic is 4804 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 :)

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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};


Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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, ...)

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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 :-)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!