Mon, 03 Aug 2009 11:06:53 -0400, Steven Schveighoffer wrote:

> I just thought of another issue with property definitions.  How do you  
> declare a property of an array?  Today it's:
> 
> char[] chomped(char[] input);
> 
> Note that any getter property contains an argument which is the object  
> you're calling the property on (normally implied because the definition is  
> inside an aggregate definition).  But with arrays it's explicit.
> 
> So how does this fit in Walter's proposed syntax?
> 
> char[] chomped {...}
> 
> Where does the input go?

I proposed a keyword, 'inject', a year ago.  Or it could be an
annotation.  I suppose such a keyword might significantly simplify
implmentation of external functions and properties:

@inject @property char[] chomped(char[] arr) {...}
@inject void sort!(alias pred, T)(T[] arr) {...}

Though prepending 'this' to the first parameter may also work, C# style.

Reply via email to