Is @property implementable?
%u
wfunction at hotmail.com
Wed Mar 2 23:12:43 PST 2011
> Well, it wouldn't be universal then. For a function to be treated
as a property, it would require an annotation, but universal
function call syntax isn't supposed to require an annotation any
more than calling a function on an array as if it were a member
function requires an annotation. It's supposed to work with any
function.
So are you saying a hypothetical function like
char[] strcpy(char[] destination, const char[] source);
should be callable like:
myString.strcpy(myString2);
?
Isn't that asking for disaster, since it does the exact opposite of
what the user expects (since the source and destination are
switched)?
I think we need an annotation for this (even for arrays), since
otherwise it's too easy to go wrong.
More information about the Digitalmars-d
mailing list