@property needed or not needed?

Rob T rob at ucora.com
Sun Dec 2 10:47:26 PST 2012


There's more than just @property that operate like variables.

Should we restrict this as well?

struct stdio
{
    void opAssign(T)( T a_arg )
    {
       writeln( a_arg );
    }
}

main()
{
    stdio writeln;
    writeln = "hellow world";
}

Conceptually, I don't see why we have to impose a difference 
between how variables are assigned and how functions are called.

A variable "=" assignment is simply a special case of a function 
call that is written for you by the compiler.

The example of opAssign shows that for some time now, there's 
been pressure to eliminate the difference in at least some cases, 
and allow the programmer to implement their own version of the 
assignment function call.

If you want to remove inconsistencies, then the way functions and 
variables are manipulated should be unified.

If someone can honestly demonstrate a non-subjective reason why 
there must be a difference between function call and variable 
assignments, please show it. So far I've only seen arguments that 
boil down to "I don't like it".

--rt



More information about the Digitalmars-d mailing list