Beta D 2.071.2-b3
Steven Schveighoffer via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Thu Sep 1 13:46:50 PDT 2016
On 8/31/16 5:56 AM, Johan Engelen wrote:
> On Tuesday, 30 August 2016 at 23:54:45 UTC, Martin Nowak wrote:
>>
>> Allowing access to private members has a lot of implications, e.g.
>> breaks lots of optimizations b/c you can't know who accesses sth.
>
> "lots of optimizations"
> Can you mention a few?
I'm not sure optimizations are had by private variables. Some
optimizations can be had because the compiler can prove a variable could
not have been changed. But I don't know that private suits that need,
it's more due to const or immutable.
> (I can only think of complicated stuff that requires pretty much
> whole-program analysis to prove validity, and in that case adding
> `private` doesn't help any more)
Where I see private helping is conceptual -- I know that if a variable
is private, I can narrow to a given module all the places the variable
might be read or written. If you just allow private access via anywhere,
it defeats that analysis.
-Steve
More information about the Digitalmars-d-announce
mailing list