2013-07-29 11:27:20 +08:00
|
|
|
das, an experimental Unix shell
|
|
|
|
===============================
|
2013-06-16 16:45:22 +08:00
|
|
|
|
2013-09-21 21:05:27 +08:00
|
|
|
This is a work in progress. Things may change and/or break without notice. You
|
|
|
|
have been warned...
|
|
|
|
|
2013-09-22 18:49:07 +08:00
|
|
|
Philosophy
|
|
|
|
----------
|
|
|
|
|
|
|
|
The basic idea is to have a shell that is also a decant programming language.
|
|
|
|
Shells have long rejected such things as data structure beyond text arrays.
|
|
|
|
Some support associative arrays, which may be assigned to variables but not
|
|
|
|
passed as arguments to builtins or shell functions, making the use of them
|
|
|
|
very tedious.
|
|
|
|
|
|
|
|
The lesson of Tcl has taught us the "everything is (unstructured) text"
|
|
|
|
philosophy, which is also the idea underpinning classical Unix pipelines, is
|
|
|
|
too limited for proper programming. Indeed, the power of Tcl often lies in the
|
|
|
|
dynamic interpretation of text, assuming some predefined structure in it. Yet
|
|
|
|
with shells, where such facilities are nonexistent, the attempts to build
|
|
|
|
maintainable
|
|
|
|
|
|
|
|
However, the shell does come with a very powerful abstraction - the pipeline.
|
|
|
|
It is basically a facility for concatenative programming. Consider the
|
|
|
|
following code in lisp:
|
|
|
|
|
|
|
|
```
|
|
|
|
(set coll' (map f (filter pred coll)))
|
|
|
|
```
|
|
|
|
|
|
|
|
Written concatenatively, this can be - assuming `put` puts the argument to
|
|
|
|
output (akin to `echo`), and `set` can take data from input in place of in the
|
|
|
|
argument list:
|
|
|
|
|
|
|
|
```
|
|
|
|
put $coll | filter pred | map f | set coll2
|
|
|
|
```
|
|
|
|
|
|
|
|
The concatenative approach is much more natural (try reading both versions
|
|
|
|
aloud).
|
|
|
|
|
|
|
|
[to be finished]
|
|
|
|
|
2013-09-18 16:45:18 +08:00
|
|
|
Building
|
|
|
|
--------
|
|
|
|
|
2013-09-21 21:05:27 +08:00
|
|
|
You need go >= 1.1 to build this. Just run `make`. The resulting binary is
|
|
|
|
called `das`.
|
|
|
|
|
|
|
|
Name
|
|
|
|
----
|
|
|
|
|
2013-09-21 21:08:54 +08:00
|
|
|
Indeed, **das** is not a very good name for a Unix shell. The name is actually
|
|
|
|
a corrupted form of **dash**, which also happens to be the German definite
|
|
|
|
neuter article.
|
|
|
|
|
|
|
|
I have some other ideas in mind. One of them is **elv**, since I found elvish
|
|
|
|
to be a great adjective - I can't use "elf" though, since it's already
|
|
|
|
[taken](http://www.cs.cmu.edu/~fp/elf.html) and may be confused with the well
|
|
|
|
known [file
|
2013-09-21 21:05:27 +08:00
|
|
|
format](http://en.wikipedia.org/wiki/Executable_and_Linkable_Format).
|
|
|
|
|
|
|
|
Another possible source of names is the names of actual seashells; but my
|
|
|
|
English vocabulary is too small for me to recall any beyond "nautilus", which
|
|
|
|
is both too long and already taken.
|
|
|
|
|
|
|
|
I'm not avoiding names ending in "sh" though; but I do find "bash" to be a
|
|
|
|
terrible name. "fish" is clever, but it has a quite unpleasant adjective.
|
2013-09-18 16:45:18 +08:00
|
|
|
|
2013-07-26 14:46:24 +08:00
|
|
|
License
|
|
|
|
-------
|
|
|
|
|
|
|
|
BSD 2-clause license. See LICENSE for a copy.
|