Properties
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Mon Jan 12 07:15:46 PST 2009
Nick Sabalausky wrote:
> void func(ref int x) {...}
> func(foo.aProperty);
>
> void func(int* x) {...}
> func(&foo.aProperty);
>
> *Should* work with both variables and properties (but might need some
> thinking in how to actually pull it off correctly. Someone mentioned C# just
> doesn't even bother with it.)
That just can't work without radically changing what a pointer is.
Disallowing pointers to properties is really the best fix.
If you really wanted, you might be able to wrap a getter/setter pair
into a struct and pass that instead (and have default getter/setter
templates for non-properties).
It's probably easier to just pass in getter/setter delegates explicitly
though.
More information about the Digitalmars-d
mailing list