rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* Re: more wishes for chrismas
@ 1992-12-04 14:02 Alan Watson
  1992-12-04 14:48 ` Steve Rezsutek
  1992-12-05 16:21 ` Dave Mason
  0 siblings, 2 replies; 11+ messages in thread
From: Alan Watson @ 1992-12-04 14:02 UTC (permalink / raw)
  To: rc; +Cc: malte

The backslash is used by so many Unix utilities (in particular sed)
that it would be a pain to have it as an escape character is the
shell.  I have got so used to typing:

	; sed 'some-guff-including-\' <foo >bar

that I use quotes whenever I type:

	; sed 'some-guff-not-using-shell-meta-characters' <foo >bar

I very rarely make quoting errors in rc, but I used to make them all
of the time in sh.  Quoting is one less think I have to think about,
and that allows me to devote more attention to getting other stuff
done.

Tom Duff got this one not just right, but perfect.

There are a few characters which only make sense at certain places --
like "=" which has to be quoted in dd commands -- but at least the
current rules have a simplicity about them.  No "foo does bar except
for on the third Wednesday in the month if the month starts on a
weekend."

Alan.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: more wishes for chrismas
  1992-12-04 14:02 more wishes for chrismas Alan Watson
@ 1992-12-04 14:48 ` Steve Rezsutek
  1992-12-05 16:21 ` Dave Mason
  1 sibling, 0 replies; 11+ messages in thread
From: Steve Rezsutek @ 1992-12-04 14:48 UTC (permalink / raw)
  To: rc

Alan Watson <alan@oldp.astro.wisc.edu> sez...

> I very rarely make quoting errors in rc, but I used to make them all
> of the time in sh.  Quoting is one less think I have to think about,
> and that allows me to devote more attention to getting other stuff
> done.

Sounds like my experience, too.

And further...

> There are a few characters which only make sense at certain places --
> like "=" which has to be quoted in dd commands -- but at least the
> current rules have a simplicity about them.  No "foo does bar except
> for on the third Wednesday in the month if the month starts on a
> weekend."


I couldn't agree more.  One of the things I like most about rc is 
the simple rule: 'it''s either quoted, or it isn''t'.  

For things like arguments to dd, the biological CPU overhead of 
typing two extra characters is a small price to pay in exchange for 
not having to constantly think about which type of quoting to apply 
where.

If y'all want my $0.02,  I'd say 'nay' to backslash quoting...


Steve


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: more wishes for chrismas
  1992-12-04 14:02 more wishes for chrismas Alan Watson
  1992-12-04 14:48 ` Steve Rezsutek
@ 1992-12-05 16:21 ` Dave Mason
  1 sibling, 0 replies; 11+ messages in thread
From: Dave Mason @ 1992-12-05 16:21 UTC (permalink / raw)
  To: rc

> Date: Fri, 4 Dec 1992 09:02:51 -0500
> From: Alan Watson <alan@oldp.astro.wisc.edu>
> 
> There are a few characters which only make sense at certain places --
> like "=" which has to be quoted in dd commands -- but at least the
> current rules have a simplicity about them.  No "foo does bar except
> for on the third Wednesday in the month if the month starts on a
> weekend."

This is the only spot where I get bitten occasionally and wouldn't
mind a change.  If local assignments were only allowed at the
beginning of lines, then:
	dd count=1 bs=512
wouldn't cause a problem.  In fact, looking at the grammar in the rc
manual, assignments *are* only allowed at the beginning of lines, and
I don't see the rule that causes the problem.

../Dave


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: more wishes for chrismas
  1992-12-04 12:53 malte
  1992-12-04 14:03 ` Gerry.Tomlinson
@ 1992-12-08 15:21 ` Mark-Jason Dominus
  1 sibling, 0 replies; 11+ messages in thread
From: Mark-Jason Dominus @ 1992-12-08 15:21 UTC (permalink / raw)
  To: rc; +Cc: mjd


> make '#' introduce a comment only at the beginning of a line or
> if preceeded by white space only.
> 
> Our new students find it difficult to quote emacs backup file names when they
> want to move or delete them.

Just for the information of people using GNU `readline':

If there is a file named 
	#foo#

in the current directory, then if you do filename completion on
	'#

you get
	'#foo#'



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: more wishes for chrismas
@ 1992-12-06  8:21 Byron Rakitzis
  0 siblings, 0 replies; 11+ messages in thread
From: Byron Rakitzis @ 1992-12-06  8:21 UTC (permalink / raw)
  To: egsirer, rc

>However, "~" gets promoted around
>*in the lexer*, which is not a good thing.

Maybe this is true in Duff's rc (I don't see how or why, actually) but
it certainly isn't true about my lexer. The only serious lexical hacks
are free carets and the treatment of '('. I guess you can also include
the scanning of variable names (which are presumed to be in the
character class [a-zA-Z0-9_*]).

>	1. Promote '=' as if it was a keyword.

Would anyone like to submit a working yacc grammar for this? After playing
with the grammar for a little bit, I didn't find a way to do this for '='.
It's my suspicion that a working grammar that promoted '=' would be very
ugly, but I'd love to be disproved.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: more wishes for chrismas
@ 1992-12-05 20:52 Emin Gun Sirer
  0 siblings, 0 replies; 11+ messages in thread
From: Emin Gun Sirer @ 1992-12-05 20:52 UTC (permalink / raw)
  To: dmason, rc

>From: Dave Mason <dmason@plg.uwaterloo.ca>
>Date: 	Sat, 5 Dec 1992 11:21:13 -0500
>
>> Date: Fri, 4 Dec 1992 09:02:51 -0500
>> From: Alan Watson <alan@oldp.astro.wisc.edu>
>> 
>> There are a few characters which only make sense at certain places --
>> like "=" which has to be quoted in dd commands -- but at least the
>> current rules have a simplicity about them.
>
>This is the only spot where I get bitten occasionally and wouldn't
>mind a change.  If local assignments were only allowed at the
>beginning of lines, then:
>	dd count=1 bs=512
>wouldn't cause a problem.  In fact, looking at the grammar in the rc
>manual, assignments *are* only allowed at the beginning of lines, and
>I don't see the rule that causes the problem.

Yes, promotion is inconsistent. For example:
;~ a sdfdsfg
[status 1]
;ls file1 ~ file3
;ls file1 = file3
[syntax error]

;in arg1
syntax error
;cmnd in asfd
;(elem1 in elem3)

So the rule in the latter part is that the keyword gets promoted to a string
unless it is the first word on a line. But the same thing is not true of "=",
which does not get promoted anywhere. However, "~" gets promoted around
*in the lexer*, which is not a good thing.

The solutions I see, in order of desirability as far as I'm concerned:

	1. Fix dd and awk (I was at Bell Labs when someone changed the plan9
dd to take "-infile fname" and "-outfile" as opposed to "infile=fname". People
were furious that a lot of their scripts had to be fixed. But it only
happens once and saves a lot of headache later on).

	1. Promote '=' as if it was a keyword. Put '~' promotion in the
grammer along with '='.

	1. Promote all syntax error causing keyword constructs to strings 
(this'll require following multiple paths through the parser but is doable)
and retry.

	Duff's rc paper praises sh for using recursive descent, but criticizes
it because a lot of the routines change their behaviour according to some
flags. The counterpart to this in a yacc-based program is the special
treatment of certain tokens in the lexer. Yes, it's nice that rc has a
yacc grammer that anyone can understand, but does everyone know when a given
character represents token TWIDDLE or CHAR and is this treatment uniform
for all characters that are more or less the same ??

	Gun.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: more wishes for chrismas
@ 1992-12-04 22:05 Chris Siebenmann
  0 siblings, 0 replies; 11+ messages in thread
From: Chris Siebenmann @ 1992-12-04 22:05 UTC (permalink / raw)
  To: rc

| 1) back slash to escape a single character or alternatively
| 2) make '#' introduce a comment only at the beginning of a line or
|    if preceeded by white space only.

 Ugh and ugh.
 These go against the whole philosophy of quoting in rc (not to
mention breaking existing scripts, especially 2). If you want to make
this modification, please don't call the result 'rc'. You might be
better off hacking up one of the shells designed to be user-cuddly at
all costs, even; zsh, say. No one cares about consistency in them.

	- cks


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: more wishes for chrismas
@ 1992-12-04 16:53 Tom Culliton x2278
  0 siblings, 0 replies; 11+ messages in thread
From: Tom Culliton x2278 @ 1992-12-04 16:53 UTC (permalink / raw)
  To: malte, rc

>I'd like to add two things to the christmas wishlist:
>
>1) back slash to escape a single character or alternatively

NO NO NO NO!  God protect us from creeping featurism!  One of the most
beautiful things about rc as it stands is the purity and simplicity of
it's quoting.  I remember battling with the quoting in sh and ksh and
can't stand the thought of going back.

>2) make '#' introduce a comment only at the beginning of a line or
>   if preceeded by white space only.
>
>Our new students find it difficult to quote emacs backup file names when they
>want to move or delete them.
>
>Malte

This is how I currently use the comment character, but rc's existing
simplicity still seems perferable to me.

Tom


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: more wishes for chrismas
@ 1992-12-04 14:58 peter
  0 siblings, 0 replies; 11+ messages in thread
From: peter @ 1992-12-04 14:58 UTC (permalink / raw)
  To: rc

> 1) back slash to escape a single character or alternatively
> 2) make '#' introduce a comment only at the beginning of a line or
>    if preceeded by white space only.

No thanks!  I think it would be better to keep the rules simple and
consistent as they are now, that's why Tom Duff wrote ``rc'' wasn't it?  It
would be better in the long run to teach the students from day one, that
``#'' is a comment, and "'" is for quoting.  Otherwise they might as well
use ``sh'' and it's derivatives :-).

Pete.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: more wishes for chrismas
  1992-12-04 12:53 malte
@ 1992-12-04 14:03 ` Gerry.Tomlinson
  1992-12-08 15:21 ` Mark-Jason Dominus
  1 sibling, 0 replies; 11+ messages in thread
From: Gerry.Tomlinson @ 1992-12-04 14:03 UTC (permalink / raw)
  To: rc

> 
> I'd like to add two things to the christmas wishlist:
> 1) back slash to escape a single character or alternatively
> 2) make '#' introduce a comment only at the beginning of a line or
>    if preceeded by white space only.
> 
> Our new students find it difficult to quote emacs backup file names when they
> want to move or delete them.

and how about lpr -#2 filename ....	?

	Gerry.

--
Gerry.Tomlinson@newcastle.ac.uk
Computing Laboratory, The University, Newcastle upon Tyne, UK, NE1 7RU
Tel: +44 091 222 8139



^ permalink raw reply	[flat|nested] 11+ messages in thread

* more wishes for chrismas
@ 1992-12-04 12:53 malte
  1992-12-04 14:03 ` Gerry.Tomlinson
  1992-12-08 15:21 ` Mark-Jason Dominus
  0 siblings, 2 replies; 11+ messages in thread
From: malte @ 1992-12-04 12:53 UTC (permalink / raw)
  To: rc

I'd like to add two things to the christmas wishlist:

1) back slash to escape a single character or alternatively
2) make '#' introduce a comment only at the beginning of a line or
   if preceeded by white space only.

Our new students find it difficult to quote emacs backup file names when they
want to move or delete them.

Malte



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~1992-12-08 15:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-12-04 14:02 more wishes for chrismas Alan Watson
1992-12-04 14:48 ` Steve Rezsutek
1992-12-05 16:21 ` Dave Mason
  -- strict thread matches above, loose matches on Subject: below --
1992-12-06  8:21 Byron Rakitzis
1992-12-05 20:52 Emin Gun Sirer
1992-12-04 22:05 Chris Siebenmann
1992-12-04 16:53 Tom Culliton x2278
1992-12-04 14:58 peter
1992-12-04 12:53 malte
1992-12-04 14:03 ` Gerry.Tomlinson
1992-12-08 15:21 ` Mark-Jason Dominus

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).