[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3. General

This section contains general questions about scsh: what it is, where to find it, etc.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1 What is scsh?

Scsh is a Scheme shell. That is, it is a Unix shell which uses Scheme as its scripting language. It was designed and written by Olin Shivers, Brian Carlstrom, Martin Gasbichler and Mike Sperber, and is built on top of Scheme 48, an implementation of Scheme written by Jonathan Rees and Richard Kelsey.

Scsh currently includes the following features:

However, it is currently aimed primarily at scripting use, rather than interactive use (see section 4.6 Can I use scsh as an interactive shell?).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2 How do you pronounce scsh?

According to Olin, scsh is pronounced "skishhhh" (it rhymes with "fish").


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3 What is the current version of scsh?

The current version (as of June, 11 2006) is 0.6.7.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4 What are the licensing terms for scsh?

Scsh is distributed under a BSD-like open source licence. Here are the exact terms, which can be found in the file `COPYING' of the distribution:

Copyright (c) 1993-2002 Richard Kelsey and Jonathan Rees Copyright (c) 1994-2002 by Olin Shivers and Brian D. Carlstrom. Copyright (c) 1999-2002 by Martin Gasbichler. Copyright (c) 2001-2002 by Michael Sperber.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the authors may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Previous to version 0.5.2 scsh was distributed under a more restrictive licence.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.5 What is Scheme?

Scheme is a small and elegant programming language of the Lisp family, originally designed by Guy Lewis Steele Jr. and Gerald Jay Sussman. It includes powerful features like first-class procedures and continuations, and is statically scoped (like Pascal). For more information, refer to the Scheme FAQ (see section 3.9 Where can I find documentation about scsh?).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.6 What is Scheme 48?

Scheme 48 is a small and portable Scheme implementation written by Jonathan Rees and Richard Kelsey. It is based on a virtual machine architecture (i.e. it does not compile to native code).

Scheme 48 implements all the features described in R5RS (see section 3.9 Where can I find documentation about scsh?) and some extensions like exceptions and a module system.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.7 How does scsh compare to other common scripting languages?

Many scripting languages are in use today, and comparing scsh with all of them would be impossible. Here, we therefore restrict ourselves to the following three popular scripting languages: Perl, Python and Ruby. Below, they will be collectively referred to as PP&R.

To simplify the comparison, it will be split in three parts: first we will look at the programming languages themselves, that is the abstractions they offer to the programmer; then, we will look at the implementation(s) of these languages; finally, we will look at the (standard) libraries available for these different languages.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.7.1 Underlying programming languages

From a programming language perspective, scsh is different than PP&R in that it is based on a general-purpose programming language, namely Scheme. PP&R, on the other hand, were all designed to be scripting languages originally. Today many people use them for relatively large applications which do not qualify as scripts, but scripts were the primary target of these languages. This sometimes shows in their design, for example when it comes to variable declarations which are by default optional in PP&R but not in Scheme.

Scheme is also special in that it is a functional programming language, whereas Python and Ruby are object-oriented and Perl is procedural (even though most modern Perl code is written using objects). This does not mean that it is not possible to do functional programming with PP&R or object-oriented programming with Scheme. It just means that in Ruby and Python the object-oriented programming style is encouraged both by the language itself (e.g. everything is an object) and the standard libraries. The same holds for Scheme and the functional programming style.

Another major difference between Scheme and PP&R is the syntax. PP&R all have infix syntax with different notations for different concepts. For example, the if conditional expression is syntactically different from, say, a function call. Scheme, on the other hand, has a very regular prefix syntax based on so-called s-expressions. In Scheme, an if looks no different than a function call.

This very regular syntax make it possible to extend Scheme using a sophisticated macro system. Such macros are used in several crucial places in scsh, for example to support regular expressions with a syntax based on s-expressions (see below), or to provide a mechanism to iterate over the contents of a file in a way reminiscent of the AWK language.

It should finally be noted that Scheme, Ruby and at least one implementation of Python (Stackless Python) give the programmer a way to capture the current continuation. This makes it possible to implement, directly in the language, very powerful control features including coroutines. More about continuations can be found, for example, in the Scheme FAQ (see section 3.9 Where can I find documentation about scsh?).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.7.2 Language implementations

Perl, Python, Ruby and scsh are relatively close to each other when it comes to the features offered by their current implementation(s).

Ruby, Python and scsh have an interactive mode which enables one to enter expression and see the result of their evaluation. Perl does not include such a mode by default, even though its debugger can be used as a basic interactive evaluator. Ruby, Python and scsh also provide a debugger.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.7.3 Libraries

Because of their popularity, there is an impressive amount of third-party libraries available for PP&R, which cover many application domains. Currently, the same cannot be said about scsh, although a few third-party libraries are available (see section 4.4 Is there some kind of "contributed code archive" for scsh?).

That said, scsh has excellent support for writing scripts in a Posix environment, which is its main domain of application. A great design effort has been put into making Posix look nice from scsh. This is accomplished not only by providing nicer names for Posix functions, but also by altering their behaviour. This contrasts with PP&R which often use both the name and the behaviour of the standard Posix functions.

One example situation where scsh diverges both from Posix and PP&R is child process management. With Posix and PP&R, when a child process exits, its parent process has to wait on it explicitly. If it fails to do so, the dead child process (actually some information about it, like its exit status) remains in the kernel's process table, as a zombie process. This can be a serious problem, since the kernel's process table can eventually become full with zombie processes.

Scsh can manage dead children processes in an automatic fashion through a technique called process reaping. The basic idea is that scsh takes care of waiting for child processes and stores their exit status in the Scheme data-structure associated to them. The scsh programmer is then free to wait or simply ignore its children, without having to worry about zombie processes.

Another strength of scsh is its handling of regular expressions. Since regular expressions are important in many scripting applications, pretty much all scripting languages provide support for them, and PP&R or scsh are no exceptions. It should be noted that the regular expressions offered by scsh have some limitations when compared to PP&R, like the lack of non-greedy versions of some operators. On the other hand, scsh's regular expressions have some very interesting properties not found in PP&R:


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.7.4 Example script

The following code snippets aim to provide an idea of how scsh compares with other common scripting languages. They all print a list of all the executables available in the current PATH to the standard output (improvements to these examples are welcome).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.8 Where can I get scsh?

The latest version of scsh can be downloaded from the scsh home page, located at http://www.scsh.net/.

There is also a SourceForge projet page for scsh at http://scsh.sourceforge.net/.

Binaries for the Debian distribution of GNU/Linux are available from http://www.debian.org/Packages/stable/interpreters/scsh.html. A binary RPM for Red Hat Linux for x86 is available in the shells group of the libc6 contrib archive (say rpmfind scsh).

Binaries for win32 using Cygwin32 are available at http://xarch.tu-graz.ac.at/autocad/lisp/cl/scsh-0.5.2-cygwin-bin.tgz (thanks to Reini Urban). These require a recent version of cygwin1.dll. And please notice that this is an old (0.5.2) version of scsh, not the latest.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.9 Where can I find documentation about scsh?

The main documentation about scsh is the scsh manual. It is included in the distribution, in `<prefix>/lib/scsh/doc/scsh-manual' where `<prefix>' is the location where you installed scsh.

You may also want to take a look at the technical report describing the design of scsh. It is also included in the distribution, in `<prefix>/lib/scsh/doc/scsh-paper'.

The documentation about Scheme 48 is also worth reading, since it describes features like the module system, the interface with C, the command processor and some interesting libraries. It is in `<prefix>/lib/scsh/doc/s48-manual'.

Also, since scsh is written on top of a Scheme system, you have access to the great power of Scheme. However, no Scheme documentation is available with scsh, so you may wish to obtain the standard Scheme references as well. Here are some useful pointers:

The home-pages of the various people involved in the design of Scheme, Scheme 48 or scsh may also be of interest to you. Here are some links:


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.10 Is there some kind of reference card for scsh?

Not exactly. There is a small list of all of scsh's functions in the file `doc/cheat.txt', but it has not been updated for quite some time. However, it would be great to have a nice TeXified reference card, which would include R5RS functions as well (something like the nice Perl reference card).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.11 Which newsgroups and mailing-lists are related to scsh?

Currently, there is a mailing-list which is mirrored to a newsgroup.

To (un)subscribe to the mailing-list, send a message to scsh-users-request@scsh.net. To submit a message to the mailing-list, send it to scsh-users@scsh.net.

The mailing-list is also readable as a standard newsgroup, thanks to gmane, a mail-to-news gateway. More information is available at the following URL:
http://gmane.org/info.php?group=gmane.lisp.scheme.scsh

There used to be a newsgroup dedicated to scsh, called `comp.lang.scheme.scsh' but it is now deprecated.

Also, `comp.lang.scheme', which talks about Scheme in general, may be of interest to you. If Scheme is your first functional language, you might also want to read `comp.lang.functional'.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.12 Does scsh run on my system?

Currently, scsh runs without modification on the following systems: Harris CXUX, HP-UX, IBM AIX, Linux, FreeBSD (see section 4.2 Is there a "port" of scsh for FreeBSD?), OpenBSD, NetBSD, NeXTSTEP, SGI IRIX, Solaris, SunOS, MacOS X and Win32. It should also run without too many changes on other 32 bits UNIX platforms (for 64 bit platforms like Digital Unix, see section 3.13 Is scsh easy to port?)

Since version 0.6, scsh doesn't run on Ultrix anymore, and users of this system are encouraged to use version 0.5.3 instead.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.13 Is scsh easy to port?

On 32 bits UNIX machines, yes, usually. If your system isn't already supported, take a look at the file `doc/install.txt' which contains porting instructions.

Porting scsh to 64 bit UNIX machines (or, more generally, non-32 bit machines) is currently harder. The main reason is that this requires modifications to the Scheme 48 virtual machine (VM). This VM is written in PreScheme, a dialect of Scheme, and the PreScheme compiler is distributed with scsh. A paper about PreScheme is available through Richard Kelsey's Web page:
http://s48.org/~kelsey/

In any case, never try to hack the C code generated by the PreScheme compiler (file `scheme48vm.c'); this is ugly and you'll have to restart from scratch for the next release of Scheme 48.

Apart from the problems with the Scheme 48 VM, there are also some problems with scsh: the current version contains C code that assumes 32-bitness. This occurs mainly in the foreign-function interfaces (that is, interface between Scheme and C), where integers are converted between their Scheme and C representation.

Since v0.5.2 there is also a port to Win32 which uses the cygwin32 toolkit (thanks to Brian Carlstrom).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.14 Can I run scsh under some other Scheme implementation?

Currently, scsh is tightly bound to Scheme 48 because it uses two non-standard features of Scheme 48: its module system and its foreign function interface (FFI). This does not mean that porting it to another Scheme implementation is impossible, but it is certainly hard.

Mike Sperber and Richard Kelsey are drafting a SRFI for a standard FFI based on the current Scheme 48 FFI. This would help in making scsh portable, since its C part could be easily reused with other implementations using this FFI.

Matthew Flatt will be implementing this standard FFI for PLT Scheme. Therefore, PLT Scheme may become a viable alternative to Scheme 48 for scsh users. PLT Scheme is an umbrella name for a family of implementations of Scheme, which includes DrScheme and MzScheme. More information about it can be found at:
http://www.plt-scheme.org/

There is also a near-complete port of scsh to the Guile interpreter by Gary Houston, which you can access by cvsweb at http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-scsh/. It needs the guilerxspencer and rxspencer packages, available at http://arglist.com/guile/.

While scsh was designed primarily for Scheme, most of it can be ported with some adaptations to other languages. We are currently aware of one such port for Objective Caml, called Cash, which can be found at:
http://pauillac.inria.fr/cash/


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Michel Schinz on June, 11 2006 using texi2html