Is @property implementable?

Jonathan M Davis jmdavisProg at gmx.com
Wed Mar 2 20:41:19 PST 2011


On Wednesday 02 March 2011 20:17:48 Bekenn wrote:
> On 3/2/2011 6:36 PM, Jonathan M Davis wrote:
> > Because a property must be a property _of_ something. It's essentially an
> > abstraction of a member variable. It allows you to use a function as if
> > it were a member variable. That's its whole purpose.
> 
> Very much agreed.
> 
> I'm not sure I'm familiar with UFCS; can you point me to some
> documentation/discussion on it?

Uniform Function Call Syntax. It means that _any_ type could have functions 
called on it as if they were member functions of that type. e.g. 

"hello".find("e");

or

2.max(7);

That means that you could use the same function call syntax with all types 
instead of just user-defined types.

However, at present, in only works with arrays. It may end up being implemented 
for all types at some point, or it may not. But if it _is_ implemented, then any 
type could have the same issue with property functions that Michel Fortin 
brought up. But again, for now (and possibly forever), it only works with 
arrays.

- Jonathan M Davis


More information about the Digitalmars-d mailing list