On Monday, 9 November 2015 at 21:56:22 UTC, Fyodor Ustinov wrote:
Hi!

Why do need "@proprety" if everything works without it?

WBR,
    Fyodor.

Check out the following code:


        struct Test {
                int foo() {
                        return 2;
                }
                int bar() @property {
                        return 2;
                }
        }

pragma(msg, typeof(Test.foo)); // Prints int(); i.e. a zero-argument function that returns an int
        pragma(msg, typeof(Test.bar)); // Prints int; i.e. a plain int

AFAIK when @property was introduced, it was expected that after a deprecation period, calling non-property functions without parenthesis would be invalid, but I don't think that panned out. It's still good for documentation.
  • @property Fyodor Ustinov via Digitalmars-d-learn
    • Re: @property Alex Parrill via Digitalmars-d-learn
    • Re: @property Kagamin via Digitalmars-d-learn

Reply via email to