Ary Borenszweig wrote: > downs escribió: >> dsimcha wrote: >>> I know I've probably mentioned this one here before, but it was >>> buried in long >>> threads. >>> >>> Could we put a feature in the language that allows private member >>> variables to >>> be cast to public? The idea is that, if a class/struct designer makes >>> something private, they're saying it's a bad idea to mess with it, >>> and that >>> you do so at your own risk. However, I think there needs to be a >>> back door to >>> cowboy this one, because otherwise private/protected is just too >>> restrictive >>> for a language like D. It would work something like this: >>> >>> struct Foo { >>> private uint bar; >>> } >>> >>> void main() { >>> Foo foo; >>> foo.bar++; // error >>> (cast(public) foo.bar)++; // Works. >>> } >> >> I can second this. >> >> For instance, in Phobos1 there is no way to create a Socket from a >> file handle, so I have to monkey with offsets in my IRC bot code. > > Did you ask for an enhancement?
Phobos*1*.