rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* Re: rc as an embedable language
@ 1991-08-26 18:38 Arnold D. Robbins
  0 siblings, 0 replies; 3+ messages in thread
From: Arnold D. Robbins @ 1991-08-26 18:38 UTC (permalink / raw)
  To: rc

> Date: Sat, 24 Aug 1991 01:19:13 -0500
> From: emory!redvax.uucp!hugh ("D. Hugh Redelmeier")
> Subject: rc as an embedable language
> 
> I like interactive visual editing of history in an interactive
> shell.  There.  I have admitted it.  I even like filename completion!

Me too!

> I don't like fat and ugly interactive history support in my scripting
> language.

Me too!

> How can these be resolved?  Some ways:

A fourth way:

 - Put all the interactive candy into readline.

This is what Byron chose, and is actually reasonable.  At my urging,
Chet Ramey of bash fame has been beating on vi mode in readline.  I sent him
diffs so that when a person does a file name completion on

	; echo ~arnold/a*

readline turns it into

	; echo /u/arnold/a1 /u/arnold/a2

so that rc never sees the ~ stuff (diffs work for vi and emacs mode).
I almost had it working so that a new key did plain tilde expansion.
This is a compromise --- the user has to type something to do the expansion,
but the hair all stays in readline.  For scripts, a simple function
would do:

	fn homedir { for (i) awk -F: '$1 == '$i' { print $6 }' }

	echo `{homedir arnold joe jane}

> I would like to suggest that a version of the first technique could
> have some advantages.  If rc were implemented as a (shared?)
> library, like TCL, it would be easy to create two variants of the
> same shell.  One could have the interactive candy; one could be a
> lean and elegant scripting shell.  Much of the two shells would be
> shared.
> 
> This library would also be attractive as an embeddable language,
> much like Scheme and TCL.

This has some real possiblities.

David Korn once told me about some work people did making ksh an embeddable
language, and hooking it into their X-Windows application.  They could write
a ksh script for when buttons were pushed etc.  I think rc is more attractive
for this sort of thing, since it's a lot smaller.

The concept is by no means far-fetched.

Arnold


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

* Re: rc as an embedable language
  1991-08-24  6:19 "D. Hugh Redelmeier"
@ 1991-08-24  7:03 ` Chris Siebenmann
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Siebenmann @ 1991-08-24  7:03 UTC (permalink / raw)
  To: rc

 ash (a sh-like shell I used before rc) solved the problem of line editing
and file completion in an interestingly novel way, although it isn't fully
general: there was a sepperate file matching program, and when the editing
frontend program wanted to do file completion, it saved away the current line
and sent the underlying shell a 'fmatch partial-filename' command. There was
an escape-based sequence that fmatch and the front end used to communicate,
as well as a special set of escape sequences that could be used to hide
the actual fmatch command execution itself (if the shell knew about it).

 This worked pretty well, although it does have obvious problems; it doesn't
work in the middle of complex commands being entered on sepperate lines, and
it counts on the underlying shell being more or less sensible -- it would
break if you couldn't execute the command line.

	- cks


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

* rc as an embedable language
@ 1991-08-24  6:19 "D. Hugh Redelmeier"
  1991-08-24  7:03 ` Chris Siebenmann
  0 siblings, 1 reply; 3+ messages in thread
From: "D. Hugh Redelmeier" @ 1991-08-24  6:19 UTC (permalink / raw)
  To: rc

I like interactive visual editing of history in an interactive
shell.  There.  I have admitted it.  I even like filename completion!

I don't like fat and ugly interactive history support in my scripting
language.

How can these be resolved?  Some ways:

- Separate interactive and scripting shells.
  I find that this works pretty well.  This has been my preferred
  technique for the last four years.  It seems like a shame to have
  two independent shells (to learn, implement, or maintain).

- Separate history editor program and shell.
  This breaks down when it comes to filename completion:
  whatever does the completion must know the shell's current
  directory (not to mention that the regexp stuff needs to be
  duplicated.)

- Put it all in the shell: it won't get in your way anyway.
  My recent use of ksh supports this, but it bothers me.
  Even though I am the designer of the editing keystrokes
  used in - and --, I find them very awkward compared to ksh's
  visual intraline editing.

I would like to suggest that a version of the first technique could
have some advantages.  If rc were implemented as a (shared?)
library, like TCL, it would be easy to create two variants of the
same shell.  One could have the interactive candy; one could be a
lean and elegant scripting shell.  Much of the two shells would be
shared.

This library would also be attractive as an embeddable language,
much like Scheme and TCL.

Of course, such a change is too much to expect Byron to do, and I am
not volunteering.  I just mention this to justify my taste for
interactive candy.

Hugh Redelmeier
{utcsri, yunexus, uunet!attcan, utzoo, scocan}!redvax!hugh
When all else fails: hugh@csri.toronto.edu
+1 416 482-8253


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

end of thread, other threads:[~1991-08-26 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1991-08-26 18:38 rc as an embedable language Arnold D. Robbins
  -- strict thread matches above, loose matches on Subject: below --
1991-08-24  6:19 "D. Hugh Redelmeier"
1991-08-24  7:03 ` Chris Siebenmann

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