On 9/3/16 7:57 PM, Jonathan M Davis via Digitalmars-d wrote:
Previously __traits(allMembers, T) listed _all_ members, whereas now it wil
only list the ones that are accessible. The same for
__traits(derivedMembers, T). So, they'll still give you the private members
if you use them inside the module in question but not elsewhere.

That... doesn't sound good. I wonder how such important changes slip by Walter and myself unnoticed.

My thinking is that the plebes should be able to access things via the object.member syntax by obeying the usual visibility rules. But __traits(allMembers, T) should be the reflection backdoor that gives the savvy users total access, at the obvious cost of an awkward syntax.

The fact that __traits(allMembers, T) compiles in all cases and has DIFFERENT semantics depending on whether T is in the same vs. a different module is the deadly sign of poor language design.

Martin, any chance we can undo this change to the language?


Andrei

Reply via email to