Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!ncar!noao!arizona!gudeman From: gudeman@cs.arizona.edu (David Gudeman) Newsgroups: comp.unix.shell Subject: Re: separate the command language and interactive shell Message-ID: <2987@optima.cs.arizona.edu> Date: 9 May 91 05:09:28 GMT Sender: news@cs.arizona.edu Lines: 174 In article <1991May08.162448.13778@sco.COM> John R. MacMillan writes: ]|In article <-#8Gd-e*1@cs.psu.edu> Felix Lee writes without ]|understanding anything that he is replying to: ] ]Please try and keep this civil. I think that Felix understood what he ]was replying to. Sorry, that was ill-considered. But I was rather impressed by the fact that not one of the 5 or 6 criticisms seemed valid. One of us is certainly not understanding the other. ]|I can make the syntax as complex as needed and do file completion with ]|any characters. ] ]No you can't. You don't know what the characters mean, and every ]clang might be different. ~john means john's home to [ck]sh, nothing ]special to sh, and ``not john'' to a debugger. How do you propose to ]complete it in ish? There are two possible answers to this. First, the input of almost every interactive line-oriented program can be described with a CFG. CFG's are well-understood, easy to write, and easy to use, so you _can_ describe the full language if necessary. Alternatively, _I_ would prefer an ish that more or less ignored vagaries in file syntax -- giving a uniform way to reference files across programs. For example ~ and ~ get expanded by the ish. Clangs don't have to understand them at all. And those clangs that are already writen that don't understand these get added functionality just by running under the ish. ]It might not be an environment variable. How can the ish writer know ]what the clang writer thought a file should be? By the command-line description. ]I'm running a cooperating sh clone under ish: ] ]$ foo=bar ]$ ls -l ~/${foo}bar/pr ] ]How can ish complete that? Now change "sh" above to "ksh" and try ]again. They have to complete differently, how can ish know that? That is a trivial generalization from the examples I gave in the first post. There is nothing difficult about it. The ish knows the difference between "sh" and "ksh" because they have different command-line descriptions. ]$ ls -l ${foo%a*}ogus. I don't see anything difficult here either. ]$ IFS=': ' ]$ ls:-l:$foo/prog Changing the syntax of a clang is a problem. It can be handled, but as an ish writer I wouldn't bother. ]I don't want my clang to be restricted to your ish syntax. Keep the ]ish simple, let it do what it reasonably can (history, line editing) ]and let the clang do what it does (interpret the command line). Completion is something that is completely worthless in a batch job. That implies to me that it is an interactive function that belongs in the interactive shell. ]Again, what wild cards? Csh-like, sh-like, ksh-like? I don't want ]the ish to force this on all my clangs. I do. I want wild-card interpretation to be consistent across all programs that I use under the ish -- just like all the other interactive conviences. But if the clang writer is serious about it, these syntactic peculiarities can be included in the command-line description. The clang can still do all of the completion if the writer wants to. ]|That was one of the considerations that lead to my suggestion in the ]|first place. Write a command line description for gdb just like for ]|the clang. ] ]And another for sh, ksh, csh, rc, ed, sdb, dbx, and roll all these ]into ish? Leave the command line parsing in the command, where it's ]already being done. No, you don't roll them into the ish. You write them seperately and every ish reads the same descriptions. Yes, you write one for each program that you want to get special help from the ish. Programs that don't have these descriptions can still get the advantages of file name completion -- with no extra work at all. This is easier than writing a command completion system for each package. And for that matter, you could use the same BNF description in the bash implementation -- reducing the extra work to almost nothing. ]|]Teaching the front-end about all this gets ugly. ]|All of this is part of the front end, there is no "teaching" about it. ]Sure there is. You just said ``Write a ... description for gdb''. Lets not exaggerate the difficulty of writing a BNF description. It is certainly not as "ugly" as writing interactive features into all line-oriented programs. ]That's teaching ish about gdb syntax, whether at compile time or run ]time (I'm not sure which you're advocating). Every time you expand ish ]this way, I'll add a new clang with a conflicting syntax. There a seperate description files for each ish-ready program. The ish writer can decide whether to compile these descriptions into the ish or load them interactively. Presumably if the ish writer decides to compile them in, he thinks there is some great advantage to this that overcomes the inconvience. I'd probably write the ish to read them interactively, so adding a new clang with a new syntax is completely transparent. (I don't know what you mean by "conflicting" syntax. Conflicting with what?) ]I disagree. Completion is context-dependent on how the clang is going ]to interpret the command-line That depends on your model of completion. Some ish's may only have filename completion -- and only on files with ish syntax. ]doesn't really make the clang harder Then how come so few programs have it? ]... In both your mechanism, and the ]one Felix and I seem to like, the clang must do completion. In yours, ]you make ish parse the line and send a succinct completion request to ]the clang, which does the completion. In my system only one program --the ish-- has to do file completion. And file completion is the hardest kind to to. In your scheme, practically every program has to include the fairly substantial amount of code necessary to complete file names (or have no completion at all) and that code is only useful in interactive situation. For programs that are fequently run in batch mode the file completion code is dead weight. ] I make the clang parse the line ]_because it has to be able to parse lines anyway_ and then do the ]completion. If the clang writer wants to all do his own completion, there is nothing in my description to prevent this. Just give a trivial command-line decription that tells the ish to send any partial line to the clang for completion. But with my scheme, the clang writer has that choice. With your scheme the clang writer has the choice to write his own completion package or have no completion. My scheme has the advantage that it is completely upward compatible and transparent to existing programs. And programs can be made to work better with the ish without changing the program at all. A user that has a program that he wants to work better with the ish can just write a description file that handles the features that user wants. ]Actually it still has the problem of hiding the communication with the ]clang if you want to do that. I don't understand what you mean. ]Your scheme is complex in that it requires a command line parser be ]built into ish,... It gives the ish writer the option of implementing a generalized parser to give added functionality to the user. The ish writer doesn't _have_ to write one. I'm using a perfectly useful ish right now that doesn't parse command lines. It only completes file names and only understands shell variables and ~, but it is a lot nicer than any Unix shell I know of. And I didn't have to do anything to the csh that runs under it. It's called cmushell and runs under GNU Emacs. -- David Gudeman gudeman@cs.arizona.edu noao!arizona!gudeman