is private broken?
Seb
seb at wilzba.ch
Tue Oct 10 20:28:50 UTC 2017
On Tuesday, 10 October 2017 at 20:02:32 UTC, Jonathan M Davis
wrote:
> On Tuesday, October 10, 2017 15:33:30 Steven Schveighoffer via
> Digitalmars-d wrote:
>> On 10/10/17 3:20 PM, Jonathan Marler wrote:
>> > On windows I was able to compile the following using both
>> > dmd.2.075.1 and dmd.2.076.1
>> >
>> > From what I understand, you shouldn't be able to access
>> > private
>> >
>> > fields/methods like this...am I missing something?
>>
>> Before I even read your code, I was pretty sure the error :)
>
> LOL. Same here. It seems like almost everyone makes this
> mistake unless they caught the information first by doing
> something like reading the spec carefully or reading TDPL. And
> if you always treat your types as if nothing else can access
> their private members and don't need the equivalent of a C++
> friend function, odds are, that you'll never notice...
>
> - Jonathan M Davis
FWIW this confusion found it's way into Phobos as the unittest
was in the same module:
https://dlang.org/phobos/std_traits.html#getSymbolsByUDA
See also: https://issues.dlang.org/show_bug.cgi?id=17643
More information about the Digitalmars-d
mailing list