Fixing D's Properties

Daniel Keep daniel.keep.lists at gmail.com
Fri Aug 17 09:54:10 PDT 2007


[snip]

I emphatically agree that *something* needs to be done to address the
shortcomings of properties in D.  I mean, what's the point of having
increment/decrement and the op= operators if you cannot use them in a
large number of places?

I do have to say that I'm not a big fan of the symbol-based syntax.
Also, the inout system seems a bit... off.  The problem I have with it
is that *both* the getter and setter are marked inout, which doesn't
make a lot of sense.

Another possibility is to use contract-style notation:

int foo
{
    in(int baz) { bar = baz; }
    out() { return bar; }
}

Or even just dropping "inout" and using "in" and "out" explicitly:

in void foo(int baz) { bar = baz; }
out int foo() { return bar; }

On another note, I think you should expand on exactly how different
kinds of statements should be rewritten.  For instance, you haven't
clarified what happens here:

w.rect.x = 10;

	-- Daniel



More information about the Digitalmars-d mailing list