Why less emphasis on private data?

Neil Cerutti horpner at yahoo.com
Mon Jan 8 16:10:22 CET 2007


On 2007-01-08, hg <hg at nospam.org> wrote:
> sturlamolden wrote:
>
>> The designers of Java, C++, C#, Ada95, Delphi, etc. seem to think that
>> if an object's 'internal' variables or states cannot be kept private,
>> programmers get an irresistible temptation to mess with them in
>> malicious ways. But if you are that stupid, should you be programming
>> in any language? The most widely used language is still C, and there is
>> no concept of private data in C either, nor is it needed.
>
>
> void test(void)
> {
>   static int i;
> }
>
>
> Do you agree that i is "private" to test ?

In C one uses the pointer to opaque struct idiom to hide data.
For example, the standard FILE pointer.

-- 
Neil Cerutti



More information about the Python-list mailing list