From: "Emin G. Sirer" <egsirer@phoenix.Princeton.EDU>
To: rc@archone.tamu.edu
Subject: Re: comments, newlines
Date: Sat, 14 Mar 1992 13:39:18 -0600 [thread overview]
Message-ID: <9203141939.AA22325@burn.Princeton.EDU> (raw)
>From: Dave Mason <dmason@plg.waterloo.edu>
>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.
next reply other threads:[~1992-03-14 19:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1992-03-14 19:39 Emin G. Sirer [this message]
1992-03-15 23:31 ` James Matthew Farrow
1992-03-15 17:54 ` schwartz
-- strict thread matches above, loose matches on Subject: below --
1992-03-11 17:27 haahr
1992-03-12 22:05 ` David J. Fiander
1992-03-13 10:14 ` John Mackin
1992-03-13 22:44 ` Dave Mason
1992-03-11 7:19 schwartz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9203141939.AA22325@burn.Princeton.EDU \
--to=egsirer@phoenix.princeton.edu \
--cc=rc@archone.tamu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).