Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Dec 2007 22:55:36 +0100
From:      Peter Schuller <peter.schuller@infidyne.com>
To:        freebsd-questions@freebsd.org
Cc:        Chuck Robey <chuckr@chuckr.org>
Subject:   Re: csh programing book
Message-ID:  <200712172255.49706.peter.schuller@infidyne.com>
In-Reply-To: <4766DAD8.3030006@chuckr.org>
References:  <200712141742.30001.cblasius@gmail.com> <20071217054303.GA33846@demeter.hydra> <4766DAD8.3030006@chuckr.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart2471289.iqSRJAxXQW
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

> Well, I was only giving my personal opinion.  I've never used irb, but
> it seems to me that using any sort of OO tool as a shell would be "cruel
> and unusual", but I guess it takes all kinds, and I certainly wouldn't
> prevent you from enjoying yourself, same as I'd expect from you to mine.

The "OO" nature of it really really does not come into play here as far as =
I=20
can tell. Whatever you can imagine with perl/python/your-favorite-language =
is=20
very likely as much possible, if not more so, with Ruby.

Certainly if writing something elaborate it comes into play, but then we ar=
e=20
away from the shell aspect of the discussion.

Doing:

   system "myfile"

does not become any more obnoxious just because "myfile" happens to be an=20
object in a well-defined class-based object system. Nor does the function=20
definition:

   def myfun(param)
       ...
   end

Become obnoxious just because Ruby happens to be OO, for some definition of=
=20
OO.

My main concern is syntax. I would love to have a shell based on Ruby, Lisp=
,=20
or some other powerful language (anything that at least allows functions to=
=20
return values other than status codes... please). But I have yet to find on=
e=20
that makes it maximally simple and efficient to do the common stuff that yo=
u=20
use interactively - which is to run external processes.

scsh (Scheme Shell) comes pretty close; I have no objection to using it for=
=20
shell *scripting*. Neither might Ruby be an issue with sufficient API=20
support.

But I am not sure about using it interactively. When interactive, you don't=
=20
want to type even a single annoying character more than you have to. Or at=
=20
least I don't.

That said, scsh might be possible to tweak sufficiently. It actually manage=
s=20
to combine the power of Lisp with the convenience of shell scripting pretty=
=20
well (as always, by using macros). So you have pretty low-overhead syntax=20
like. For example, instead of:

   more myfile

You have:

   (run (more myfile))

If you imagine an interactive mode where a top-level (run (...)) would be=20
implied (under certain circumstances), you could make that be exactly=20
equivalent to the normal shell version:

   more myfile

This is true even with parameters; the macros are such that you need not=20
explicitly make them strings (so "(run (ls -l /))" is valid for example).

I especially like the integration as soon as you want to do something sligh=
tly=20
intelligent. E.g.:

   (run/strings (mystuff --list-something /path/to/db))

Yields an actual list of strings (one per line) that you can touch, pet and=
=20
otherwise have your way with even if you want to do something other than=20
piping it to the next process.

Not to mention having higher order functions at your fingertips...

In short, I would just love to have a single language for both tasks, not=20
having to "switch" from one to the other after some threshold of script=20
complexity. Unfortunately scsh has some issues (e.g., freebsd port is marke=
d=20
as broken om amd64 right now), so I dunno about counting on it being=20
available everywhere.

=2D-=20
/ Peter Schuller

PGP userID: 0xE9758B7D or 'Peter Schuller <peter.schuller@infidyne.com>'
Key retrieval: Send an E-Mail to getpgpkey@scode.org
E-Mail: peter.schuller@infidyne.com Web: http://www.scode.org


--nextPart2471289.iqSRJAxXQW
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQBHZvBlDNor2+l1i30RAqP+AJ9ziIdSW4DLWwrVrVGbTJLces8hlgCfRchM
EDNHLEIDZa70AXYrFNzlV0Q=
=cX3j
-----END PGP SIGNATURE-----

--nextPart2471289.iqSRJAxXQW--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712172255.49706.peter.schuller>