On 2011-12-13 18:13:38 +0000, "Jonathan M Davis" <[email protected]> said:

On Tuesday, December 13, 2011 12:14:37 Michel Fortin wrote:
On 2011-12-13 16:57:33 +0000, Jonathan M Davis <[email protected]> said:
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.

You mean calling a property function on an element in an array? I would only
have expected that to work if the element type had such a property. I wouldn't
ever have expected you to be able to declare a property for arrays which
allowed you to call it as a property on the array's elements.

Oops. That was a typo. I meant (front = array). "a" is undefined in the example above.


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?

Disambiguate with what? With a module-level property? As it stands, I expect
that module-level properties which are arrays just wouldn't work.

Say you have a array-member property called "front" defined in std.range (not hard to imagine) and an identical property called "front" in another module and you import both modules: "array.front" becomes ambiguous. With the function call syntax you can write std.range.front(array) and other.module.front(array) as a substitute to the property syntax to disambiguate, but if the property syntax is enforced should calling the property as a function still be allowed for array-member functions? Or should we invent a syntax such as array.(other.module.front)?

--
Michel Fortin
[email protected]
http://michelf.com/

Reply via email to