From owner-freebsd-questions@FreeBSD.ORG Mon Dec 17 21:55:53 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F046916A418 for ; Mon, 17 Dec 2007 21:55:53 +0000 (UTC) (envelope-from peter.schuller@infidyne.com) Received: from smtp.infidyne.com (ds9.infidyne.com [88.80.6.206]) by mx1.freebsd.org (Postfix) with ESMTP id 6E84413C45A for ; Mon, 17 Dec 2007 21:55:52 +0000 (UTC) (envelope-from peter.schuller@infidyne.com) Received: from c-8216e555.03-51-73746f3.cust.bredbandsbolaget.se (c-8216e555.03-51-73746f3.cust.bredbandsbolaget.se [85.229.22.130]) by smtp.infidyne.com (Postfix) with ESMTP id 0669376B45; Mon, 17 Dec 2007 22:55:51 +0100 (CET) From: Peter Schuller To: freebsd-questions@freebsd.org Date: Mon, 17 Dec 2007 22:55:36 +0100 User-Agent: KMail/1.9.7 References: <200712141742.30001.cblasius@gmail.com> <20071217054303.GA33846@demeter.hydra> <4766DAD8.3030006@chuckr.org> In-Reply-To: <4766DAD8.3030006@chuckr.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2471289.iqSRJAxXQW"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200712172255.49706.peter.schuller@infidyne.com> Cc: Chuck Robey Subject: Re: csh programing book X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2007 21:55:54 -0000 --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 ' 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--