DIP26: properties defined

Robert jfanatiker at gmx.at
Sun Feb 10 03:13:27 PST 2013


On Fri, 2013-02-08 at 22:00 -0800, Jonathan M Davis wrote:
> It would be simple enough to make it so that the compiler used auto
> ref in the 
> lowered version and just make the variable itself int, though the DIP 
> obviously doesn't say that.

That would be impossible for virtual functions in a class. What the
compiler could do, is simply provide both. This has to be thought
through, what is important is that it is very clear what the compiler
produces.

As properties are meant to be assigned (which implies a copy at some
point), you usually try to keep them small anyway or making them a class
so that you only have to assign a reference. So I think it is not a bad
choice to have the compiler simply generate the most simple trivial
form, taking the argument by value. If you really want something
different in some special application, you may still provide the
functions on your own. 

Having said that, I really don't mind having the compiler produce both,
if people think this is a good idea.



More information about the Digitalmars-d mailing list