So what does (inout int = 0) do?

ag0aep6g via Digitalmars-d digitalmars-d at puremagic.com
Sun Apr 17 11:31:56 PDT 2016


On 17.04.2016 19:39, QAston wrote:
> First @property + compiler switch, now @property + deprecated switch.
> When should I use property? For all the getters? Should I start with
> property or with member access? Does it even matter because of optional
> parens? Why do I even need to care about this?

@property is in a bad state right now. The behavior that used to be 
enabled by -property has been decided against, and now @property has 
only one effect that I can think of off the top of my head, and it's 
rather subtle:

----
int foo() {return 0;}
@property int bar() {return 0;}

pragma(msg, typeof(foo)); /* int() */
pragma(msg, typeof(bar)); /* int */

pragma(msg, typeof(&foo)); /* int function() ref */
pragma(msg, typeof(&bar)); /* int function() @property ref */
----

I don't think anyone is really happy with the current @property, but 
everyone is probably tired of discussing it.


More information about the Digitalmars-d mailing list