rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: haahr@mv.us.adobe.com (Paul Haahr)
To: rc@hawkwind.utcs.toronto.edu
Subject: Re: redirection and built-ins
Date: Mon, 7 Jun 1993 11:24:17 -0400	[thread overview]
Message-ID: <9306071524.AA16980@astro.mv.us.adobe.com> (raw)

Alan writes:
> | ``echo ... | read foo'' is not the appropriate construct in rc or es.

> Yeah, because it doesn't work; there is nothing intrinsicly
> `inappropriate' about it.

i disagree.  it's inappropriate because rc already has a perfectly good
mechanism for setting variables to the output of commands:  backquotes.
why is that not enough?  what functionality does that lack?

i don't think that the goal in rc was to provide a million different
syntaxes for the same operation.

> and I was actually thinking of a functionally-implemented read.

what does this mean?  (``functionally-implemented''?  that it works?
that it doesn't have side effects?)

> When
> I mentioned rc forking to provide redirection for built-ins, I was
> also thinking about functions, but it was sloppy writing on my part.

as far as i can tell, there are two issues here:

	(1) rc forks for all redirection operations, even ones which
	    are applied to builtins and shell functions.

	(2) rc and es fork a child process for each component of a
	    pipeline, even if some of the components are builtins
	    or functions.

(1) is handled differently in es, and seems to work ok.  in my
mind, it's a performance hack, and not a very good one, because
from the bit of profiling that i've done it doesn't make that much
of a difference.  the mechanism we came up with for doing this in
es could be applied to rc just fine, but it seems like a lot of
work for very little payoff.

(2), i think, is the right thing, because it's the only symmetric
answer.  in the pipeline
	a | b | c
if all a, b, and c are shell functions, which one should run in
the context of the shell?  what should happen if the command is
	exit 1 | exit 2 | exit 3
?  i prefer the current rc/es answer which is:  the shell does
not exit, and the return status is (1 2 3).  i believe that in
Tom Duff's verion, the top-level shell exits with either 1 or 3,
and Alan seems to argue that 3 is the right answer.

paul


             reply	other threads:[~1993-06-07 15:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-06-07 15:24 Paul Haahr [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-06-07 17:10 Alan Watson
1993-06-07  5:23 Alan Watson
1993-06-07  0:32 Paul Haahr
1993-06-05 18:59 Alan Watson
1993-06-05 18:45 Paul Haahr
1993-06-05 18:38 Alan Watson

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=9306071524.AA16980@astro.mv.us.adobe.com \
    --to=haahr@mv.us.adobe.com \
    --cc=rc@hawkwind.utcs.toronto.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).