On Thursday, 17 May 2018 at 11:18:52 UTC, KingJoffrey wrote:
On Thursday, 17 May 2018 at 10:34:18 UTC, Zoadian wrote:
On Thursday, 17 May 2018 at 02:32:07 UTC, KingJoffrey wrote:
[...]
People from c++ might be suprised by 'private' already. We do not have to confuse those c#ies too.


Interesting.

If only D had applied that same criteria to use of the word 'private'.

Have you considered the keyword `module`?

--- kings.d
class King
{
    private string _name;
    module string __name;
    public string getName()
    {
        return __name;
    }
    public void setName(string name)
    {
        __name = name;
    }
}

void main()
{
    scope king = new King();
    king._name = "me"; //ok: _name is private
    king.__name = "me"; //error: __name is of `module` scope
    king.setName("me"); //ok
}

I do wonder what word could possibly suffice, to please everyone.

`module`

/s
[...]
Again, DIP before discussion, and we all know what will happed to the DIP.

I won't oppose such an addition since it will be purely opt-in, but you will have to consider that this would add more specifiers:
`private`, `protected`, `package`, `public` and `export`.
You might also want to read these [0] past discussions on this feature. I'm not sure how up to date that doc is, but it should be a good starting point.

[0]: https://wiki.dlang.org/Access_specifiers_and_visibility#Current_state_of_affairs_in_C.2B.2B

Reply via email to