Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-tis!ames!hao!gatech!mcnc!rutgers!bellcore!faline!ulysses!mhuxt!m10ux!rgr From: rgr@m10ux.UUCP (Duke Robillard) Newsgroups: comp.lang.c Subject: Re: A bad design decision early on in A Message-ID: <472@m10ux.UUCP> Date: 4 Jan 88 18:08:22 GMT References: <1322@sugar.UUCP> <47000028@uxe.cso.uiuc.edu> Reply-To: rgr@m10ux.UUCP (Duke Robillard) Organization: AT&T Bell Labs, Murray Hill Lines: 26 In article <47000028@uxe.cso.uiuc.edu> mcdonald@uxe.cso.uiuc.edu writes: >> But they do - they add data hiding. A library can provide >> types such as time_t and addr_t for data that is generated by >> some library routines and used by others, and *you* don't have >> to know what the type is. If the variable won't fit in a >Data hiding is the worst idea ever invented. I really hate it when I find >something declared as a "time_t", or , worse, those awful structures >used by VMS C for system calls. Then one has to go back through some long >chain of garbage to find what they really mean. This is because you're not really hiding the data. You still have to know what time_t is to use the information. I hate this too. Pascal's types can lead to a viciously unreadable program by their misuse. But with a *real* implementation of data hiding, you wouldn't have to go back through that long chain of garbage. To set some variable of type foo, you'd call a function called set_foo. To print the time, you'd call a routine called print_time_t. This is a major concept behind "object oriented programming" languages, like smalltalk or (maybe) C++. -- + | Duke Robillard, novice pagan. | AT&T Bell Labs m10ux!rgr@ihnp4.UUCP | Murray Hill, NJ {any biggy}!ihnp4!m10ux!rgr