Is @property implementable?
Michel Fortin
michel.fortin at michelf.com
Wed Mar 2 16:57:42 PST 2011
On 2011-03-02 17:14:30 -0500, Jonathan M Davis <jmdavisProg at gmx.com> said:
> I would expect the compiler to be smart enough to combine the fact that you can
> call functions on arrays as if they were member functions and @property
> to allow
> you to deal with any property as if it were a member of the array. So, the fact
> that the property is declared external to the array should be irrelevant. It
> should work just the same as any property would on a user-defined type.
The basic problem is that if you declare this function:
@property int front(int[] array);
you can interpret this declaration in two ways. The standard way, where
the function behaves as a setter for the scope it belongs in:
front = array;
and the "array member" way, where the function behaves as a getter for
the property of an array:
array.front;
How is the compiler supposed to determine which one of the two you
meant (setter or getter) when you declared the function?
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list