4 features for C# 4.0(anastasiosyal.com)

submitted by AnastasiosyalAnastasiosyal(960) 3 years, 10 months ago

C# 3.0 still hasnt sunk in yet for most, yet there already seems to be some buzz about c# features we would like to see in the future. Here is my take on the 4 language features i would like to see implemented in C#

6 comments |category: |Views: 673

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by JudahGabrielJudahGabriel(814) 3 years, 10 months ago 0

Duck typing? Safe null dereferencing?

Come on guys. Those are nice things, but not critical by any means. I'd much, much rather see something that would help us write less-buggy code, such as design-by-contract attributes with compiler enforcement, ala Spec#.

[Pure]
string GetFoo(string baz, int bar)
requires baz != null && baz.Length > 0
requires bar > 0
ensures return != null;
{
...
}

This would eliminate a wide range of programming defects. How much greater importance is that than niceties like duck typing and null dereferencing!

Reply

posted by JudahGabrielJudahGabriel(814) 3 years, 10 months ago 0

Moreover, Spec#-like contracts would open the door for more concurrency, as concurrency's main blocker is side-effects. If the compiler could tell you about side effects thanks to contracts within the framework, it would remove a huge number of concurrency defects as well.

Reply

posted by topbananatopbanana(0) 3 years, 10 months ago 0

@JudahGabriel - you're better off commenting on the blog intself

Reply

posted by JudahGabrielJudahGabriel(814) 3 years, 10 months ago 0

Perhaps there as well. But folks around the .NET community need to come to this understanding, which is why I posted here.

Reply

posted by logicalmindlogicalmind(0) 3 years, 10 months ago 0

How does the compiler enforce purity? It would seem that in order to mark a method as pure all the methods that are called inside of the method must also be pure. So essentially every library call all the way down to some level (system calls???) have to be verifiably pure. How does this happen?

Reply

posted by JudahGabrielJudahGabriel(814) 3 years, 10 months ago 0

The compiler can enforce purity by allowing calls only methods which are marked as pure. Most property getters could be marked as pure, for example, as well as many utility methods that do arithmetic, deal with strings, or otherwise don't rely on and don't modify external state.

Reply

information Login or create an account to comment on this story