struct's fields are all public? no access control?
12345swordy
alexanderheistermann at gmail.com
Fri Apr 2 18:34:43 UTC 2021
On Friday, 2 April 2021 at 18:33:35 UTC, 12345swordy wrote:
> On Friday, 2 April 2021 at 15:56:43 UTC, Steven Schveighoffer
> wrote:
>> On 4/2/21 11:42 AM, Adam D. Ruppe wrote:
>>> On Friday, 2 April 2021 at 15:35:03 UTC, mw wrote:
>>>> Is this a compiler bug, or by language design?
>>>
>>> https://dlang.org/spec/attribute.html#visibility_attributes
>>>
>>> "Symbols with private visibility can only be accessed from
>>> within the same module. Private member functions are
>>> implicitly final and cannot be overridden."
>>>
>>>
>>> Key word there being "module".
>>
>> To exapand on this, this is D's answer to "friend" functions
>> in C++.
>>
>> -Steve
>
> We could introduce "this private", via DIP, but there isn't
> much motivation behind it as the workaround is define the
> struct in one module and define the function in another
> function. The private behave differently from other languages
> does not seemed to effect many people here.
>
> -Alex
I meant "in another module."
-Alex
More information about the Digitalmars-d
mailing list