On 2011-12-13 16:57:33 +0000, Jonathan M Davis <[email protected]> said:
On Tuesday, December 13, 2011 06:40:40 Michel Fortin wrote:
On 2011-12-13 04:25:33 +0000, Jonathan M Davis <[email protected]> said:
For arrays, all you need to do is have the first argument be an array,
and that works great for arrays, but arrays don't have much in the way
of functions built in, so there's no conflict.
Actually, there's still an open issue with array-member syntax and
@property used together.
How so? If it's a property function, not a member function (which couldn't use
array-member syntaxt anyway), and it takes an array as its first argument, then
it _must_ be called with array-member syntax without parens. If it isn't a
property, then you could call it with or without array-member syntax, but you
have to use parens. I don't see any conflict there.
The problem is that the definition of an array-member property getter
is the same thing as the definition of a module-level property setter.
Now, I don't know what -property is doing with it at the moment, but I don't
see how it could work any other way.
Currently I think you can do this:
import std.range;
int[] array = [1, 2];
int x = array.front; // fine
int y = (front = a); // ???
And also you can't define array-member property setters because they
take three arguments and three argument property functions are not
allowed.
And also, in case of conflict, currently you can write
`std.range.front(array)` to disambiguate, but how does that work with
@property enforcement, probably not that well?
--
Michel Fortin
[email protected]
http://michelf.com/