From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from Princeton.EDU ([128.112.128.1]) by archone.tamu.edu with SMTP id <45332>; Sat, 14 Mar 1992 13:39:47 -0600 Received: from phoenix.Princeton.EDU by Princeton.EDU (5.65b/2.86/princeton) id AA04541; Sat, 14 Mar 92 14:39:29 -0500 Received: from burn.Princeton.EDU by phoenix (5.65b/1.111) id AA13698; Sat, 14 Mar 92 14:39:22 -0500 From: "Emin G. Sirer" Received: by burn.Princeton.EDU (4.1/CS_002_Cluster_Client) id AA22325; Sat, 14 Mar 92 14:39:18 EST Date: Sat, 14 Mar 1992 13:39:18 -0600 Message-Id: <9203141939.AA22325@burn.Princeton.EDU> To: rc@archone.tamu.edu Subject: Re: comments, newlines >From: Dave Mason >Subject: RE: comments, newlines >Date: Fri, 13 Mar 1992 16:44:35 -0600 > >> From: John (I've got some bad news for you, sunshine) Mackin >> Date: Fri, 13 Mar 1992 05:14:22 -0500 > >> I claim that # should only be seen as a comment introducer if it is >> preceded by whitespace or at the start of the line. So if you do >> echo foo#bar >> you should, in my view, get "foo#bar". You do in sh. You don't in rc: >> Byron thinks # should introduce a comment even if it is in the middle >> of a word. I think this is plainly wrong. Opinions? > >Why should it be special? Because almost all the other metacharacters are 'special' in some way or another. For example, echo f* (or f[a-c]*) will either expand (if there are matching files in .) or stay as it is. I think that that behaviour is very strange, and even unjustifiable. No part of shell behaviour should depend on the environment (i.e. current working directory). I think csh's the only one that's got it right (gasp). Talking about strangeness, how do you explain to someone the bizarre parenthesis behaviour ? They seem to introduce lists one-minute (a=(a b c)) and seem to mark the clauses to the while and if statements the next. 'Special' is not the right word. All these characters are already special anyway (look in lexer.c; they are called special characters). The key thing is whether the rules governing their use make sense. I, for one, find the parenthesis usage very natural. The rule is that they delimit lists unless they follow while or if, when they delimit clauses (thus we don't see code like 'while true echo foo;' I think it is much more desirable that we use 'while(true) echo foo'). The rule for '#' should be that it introduces comments iff it is preceded by whitespace, else it's a regular character. And the kind of change we're talking about here only involves a trivial change in the lexer. > What's wrong with > echo foo'#'bar What's wrong with lpr -Gr2 -#3 foo.ps ? Why doesn't it print anything ? Do you really prefer lpr -Gr2 -'#'3 foo.ps ? Is that better syntax ? Is it more readable ? >It's not as if octothorpe is exactly the most common character, and I >think it's actually harder for people to parse by your rules, as they have >to consider the context of whether it is preceeded by whitespace. A lot of the lexical analysis (not parsing) is done in a context sensitive manner; what's the big deal ? I think sh behaviour is more desirable given that the rule is very simple (both to remember and to implement); so much so that remembering to escape the number sign is much harder than keeping the rule in mind (in fact, you don't even have to). Simplicity does not mean cumbersome notation. Gun.