November 8, 2006

C# Future Directions: Ruby

Remember that catchy RubyCLR motto?

Now C# (Anders Hejlsberg) is playing catch up talking about automatic properties:

public string Bar { get; set; }
Above is meant to be translated by a compiler into
private string foo; 
public string Bar 
{ 
    get { return foo; } 
    set { foo = value; } 
}
Now I'm not sure I like reusage of the abstract property notation, but still way to go guys.
November 8, 2006 5:35 PM | #.NET , #C#
Comments

I believe the idea is to minimize the impact on C# syntax, so reusing existing constructs.
It's not so clean though...

Posted by: Oleg Tkachenko at November 26, 2006 6:29 PM

I love the idea too but don't like the abstract property notation either. I always thought it would complimentary to the "event" keyword to do this like so:

class Foo {
public property string Bar;
public readonly property string Foo;
...
}

The only case this doesn't handle is set only properties which are so uncommon that I wouldn't mind having to implement the property the old way.

Posted by: Keith Hill at November 9, 2006 7:57 AM

I don't see why they don't just use the trivial property syntax like the one in C++/CLI, which I find just cleaner.

Posted by: Tomas Restrepo at November 8, 2006 7:42 PM
Post a comment




Remember Me?