home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!snorkelwacker.mit.edu!ai-lab!life.ai.mit.edu!tmb
- From: tmb@arolla.idiap.ch (Thomas M. Breuel)
- Newsgroups: comp.lang.c++
- Subject: Re: Just what is so great about streams?
- Date: 13 Nov 92 10:29:51
- Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
- Perceptive)
- Lines: 25
- Message-ID: <TMB.92Nov13102951@arolla.idiap.ch>
- References: <1992Nov12.061942.16473@nuscc.nus.sg>
- Reply-To: tmb@idiap.ch
- NNTP-Posting-Host: arolla.idiap.ch
- In-reply-to: tim@gold.iss.nus.sg's message of Thu, 12 Nov 1992 06:19:42 GMT
-
- In article <1992Nov12.061942.16473@nuscc.nus.sg> tim@gold.iss.nus.sg (Tim Poston) writes:
-
- This posting is a genuinely answer-seeking question,
-
- what _is_ so great about streams?
-
- Mainly that they are type-safe and user-extensible.
-
- From a coding standpoint, the << operator seems to be a case of
- `user-friendly disease'. I have to do 'x << " " << y' just to get
- a space between output numbers.
-
- Actually, I suspect most people would agree that stream syntax is
- pretty awful.
-
- Typical user-friendliness: "don't worry about type, I'll look at it
- and do what's best", with no judgement needed by the programmer.
- But sometimes Mom does not know best. For instance, if the output
- is PostScript code, a number very near zero should _not_ be output
- as 1.472e-6 It should be 0.0, or PostScript will barf.
-
- Streams come with various formatting primitives for floating
- point; use them.
-
- Thomas.
-