From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,447a948bb64464c3 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-10-19 04:24:29 PST Newsgroups: comp.lang.ada Path: bga.com!news.sprintlink.net!hookup!usc!math.ohio-state.edu!jussieu.fr!univ-lyon1.fr!swidir.switch.ch!scsing.switch.ch!news.belwue.de!news.informatik.uni-stuttgart.de!spiegel From: spiegel@bruessel.informatik.uni-stuttgart.de (Andre Spiegel) Subject: Ada programs in a UNIX environment (was Re: I have a question...) In-Reply-To: ncohen@watson.ibm.com's message of 14 Oct 1994 21:32:26 GMT [ 14 Oct 1994 22:32:26 MET ] Message-ID: Sender: news@informatik.uni-stuttgart.de Organization: University of Stuttgart, Germany References: <1994Oct07.034523.161470@zeus.aix.calpoly.edu> <37mtda$cp3@watnews1.watson.ibm.com> Date: Mon, 17 Oct 1994 10:34:43 GMT Date: 1994-10-17T10:34:43+00:00 List-Id: I wrote: > I should say that if a UNIX program needs to ask the user for a file > name, something must be wrong with its design. On which Dave Emery replied: > Some Unix programs are filters. They read standard input, and write > to standard output. This is a SMALL SUBSET of Unix programs. > Compilers, for instance, may well ask for a filename if the user > provides no filename on the command line. Thus this assertion (that a > Unix program that has to ask for a filename is 'bad') is not valid. And Norman Cohen said: > Indeed. For example, a text editor may support commands to insert a > given file in the current editing buffer, write all or part of the > current editing buffer to a file, or open a new buffer and read some file > into it. It is a real pain if the user can't use symbols like ~ in such > commands, so the editor ought to expand the file names in such commands. Of course, my above statement was intended as a rule of thumb, nothing more. Sort of a general orientation for Ada programming under UNIX: to fit neatly into what is already there. Naturally, there are cases when interactive programs *do* have to ask for filenames, and the like. I am just saying that sometimes this can be avoided, and, if so, should be avoided. For example, I wouldn't want a compiler to ask interactively, even if I didn't provide a filename. Think of the confusion if you try to use that compiler in a shell script, and you forget to supply the filename (or the file doesn't exist). If something like file name expansion is really needed in your own program (a text editor would be an example, I agree), the "rule of thumb" should also be applied, by trying to use the already existing mechanism, not (without good reason) something you write yourself JUST IN ORDER TO SIMULATE A FACILITY YOU CAN'T FIND ACCESS TO. Chances are that you'll write something _almost_, but not entirely identical. And what if the mechanism you have re-implemented gets changed (for example, a new generation of shells comes up), or your program is to be ported to, say, a non-UNIX environment, where there are completely different conventions and facilities? Finally, I think that when you really try to find a UNIX-like solution, you often end up with something you would not have thought about otherwise, but which proves quite handy in such an environment. Sometimes it's just a choice between two ways of doing things, none of which being any more difficult to implement than the other. -- Andre Spiegel | This life is a test. It is only a test. | Had this been an actual life, you would University of Stuttgart, Germany | have received further instructions as to Computer Science | where to go and what to do. -- Author unknown email: spiegel@bruessel.informatik.uni-stuttgart.de