Skip to content

Commit

Permalink
some more notes
Browse files Browse the repository at this point in the history
  • Loading branch information
ianb committed Jan 3, 2011
1 parent 60f90be commit f000611
Showing 1 changed file with 36 additions and 11 deletions.
47 changes: 36 additions & 11 deletions README.rst
@@ -1,12 +1,13 @@
JSShell
=======

.. toc:::
.. toc::

I was thinking about shells, like good ol' bash, and while they fit a
certain purpose they aren't necessarily the best way to interact with
files. They aren't very *modern*, and they are very heavily burdened
with legacy.
files and command-line programs. They aren't very *modern*, and they
are very heavily burdened with legacy (heck, there's a Posix
standard).

I'd already been thinking about a terminal in the browser (part of a
general thought I've had: why do I use any app except a browser?) --
Expand All @@ -28,6 +29,8 @@ might output *text*, but the text doesn't *live* on the console, it's
just text (ignoring for now all interactive terminal programs). So
you don't need something like ``screen`` to restart a session -- you
can store the whole thing in ``localStorage`` to the same effect!
(Well, I'm not doing that yet, but the point of **all** of this is
that *could*, not that I *am*.)

The Name
--------
Expand All @@ -49,17 +52,20 @@ The shell doesn't evaluate simply to a list of strings, instead it
creates an AST (``parser.js:Node``). Various interpolations are done
through substitutions in the AST. Only at the last moment when
running a command is it turned into a list of strings (which is the
only way to run commands -- the one fixed API we must conform to). I
hope to use this to avoid problems with embedded spaces in filenames
(i.e., treat filenames as unsplittable strings). Also it means you
can have real data structures like arrays. I haven't made much use of
this (sometimes it's just *wrong* right now), but I am hoping it will
be useful.
only way to run commands -- the one fixed OS-level API we must conform
to). I hope to use this to avoid problems with embedded spaces in
filenames (i.e., treat filenames as unsplittable strings), and maybe
it'll have other handy side-effects? Also it means you can work with
real data structures like arrays, and they won't get implicitly turned
into strings at any moment. I haven't made much use of this
(sometimes it's just *wrong* right now), but I am hoping it will be
useful.

Also I plan on allowing Javascript-side filtering of both input and
output, so that things like ``ls`` can be prettied up (e.g., making
filenames links). And just generally allowing for nice UI around the
shell experience.
shell experience. Maybe the idea could be thought of as progressive
enhancement.

Pipes, Background Jobs, etc
---------------------------
Expand All @@ -69,6 +75,10 @@ I am honestly not sure how to handle these. At this exact moment
Probably pipes should be executed on the server, to avoid
round-tripping to the client.

The whole thing isn't (yet) a programming language. But with an
emphasis on UI (not shell scripting) the target isn't really feature
parity with existing shell languages.

CoffeeScript
------------

Expand All @@ -81,7 +91,17 @@ it makes it almost seem like you are editing the native browser
language.

I've checked in the ``.js`` files so you can still run this without
CoffeeScript installed.
CoffeeScript installed. But since it's more prototype than functional
product, you should really just install CoffeeScript (once you have
Node installed, which you have to do anyway, it's easy to install
CoffeeScript).

If you are curious, I've been quite enjoying CoffeeScript. I'm trying
to avoid some of the more clever syntax, like leaving out ``()`` on
function calls, and sometimes newlines can be... quirky. But being
able to use halfway-decent loops more than makes up for that, and then
all the other nice CoffeeScript features are just icing. I'm even
feeling okay about OO programming.

Interactive/Terminal programs
-----------------------------
Expand All @@ -91,6 +111,11 @@ text. Those programs aren't supported at all. I want them all to be
replicated in the browser anyway (e.g., through an in-browser
editor).

Basic ANSI escape sequences for color output should be possible and
desirable (though it requires interpreting that stuff in Javascript --
messy but doable). What exact cleverness is necessary to fake a
program into thinking the output *supports* color is also a question.

Discussion
----------

Expand Down

0 comments on commit f000611

Please sign in to comment.