Yes, that is the idea. I normally don't like sugar, but in this case, it results in better looking code with high readability since one can drop a bunch of getFoo() and setFoo() methods.
/ Marcus Agehall (Scanian)
Previous text:
2003-12-21 14:22: Subject: C#-like properties
private int foo; public int Foo { get { return foo; } set { foo = value; } }
int x = Foo; Foo = x+1;
So what you're saying is that you'd like automatic overloading of access methods in objects, and write these functions in sub-scopes near the variable itself?
It's not a bad idea, I think. It could make it easier to write OO code, without having to resort to "getFoo or setFoo".
You can do this in Pike today, with `-> and `->=, but there isn't any sugar around it, and you can only do it if you handle all the indices of the object yourself...
Since I like sugar, I like your idea...
/ Mirar