Thread overview
The default can be used as a property is very bad design.
Jan 25, 2019
Brian
Jan 25, 2019
Adam D. Ruppe
Jan 25, 2019
Neia Neutuladh
January 25, 2019
OH NO !

sample code:

```D
import std.stdio;

struct Config
{
    string test = "aaa";
    string test2 = "bbb";
}

Config config()
{
    Config conf;
    return conf;
}

class Test
{
    void func1()
    {
        string config;

        string testConfig = config().test;

        writeln(testConfig);
    }
}
```


build error:
```shell
osx:test zoujiaqing$ dmd config.d
config.d(22): Error: function expected before (), not config of type string
```

January 25, 2019
On Friday, 25 January 2019 at 02:09:29 UTC, Brian wrote:
> OH NO !

This has nothing to do with property. It is just a local variable - those always take precedence over global ones.

Use the module scope operator to use one outside; the leading dot:

>         string testConfig = config().test;

string testConfig = .config().test; // note the leading dot

January 25, 2019
As for this being very bad design, pretty much every programming language with the concept of a local variable shares this trait.