proporty syntax dosn't work for static memebers (under some cases)
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Thu May 17 12:43:10 PDT 2007
BCS wrote:
> struct S
> {
> static void F(ref S* s){}
> }
>
> void main()
> {
> S* s;
> s.F(); // fails
Of course it fails. You forgot to specify an argument.
> s.F(s); // works
Correct, since you specified the argument this time.
> }
>
> This would be nice for some cases like where the struct has some extra
> data allocated on at the end and the function might have to reallocate.
I'm not sure what you're trying to do here and what it has to do with
property syntax.
However, you seem to think that calling a static method from an instance
(or pointer) should pass what it's called on as a parameter? The only
thing that works anything like that is arrays and functions that take
them as the first parameter...
(Also, please note that what's more commonly referred to as "property
syntax" in relation to D is leaving off the parameter brackets from a
no-argument function or "assigning" something to a single-parameter
function)
More information about the Digitalmars-d-bugs
mailing list