1. 14
  1.  

    1. 2

      I’d be curious how this compares to scsh or the like. I do like this direction; es (the rc + lambdas shell), scsh, and the like are really interesting directions that I wish was explored more (as well as alphabet from Inferno).

      1. 6

        It sounds a bit more like rash than SCSH in that the “default” syntax is the UNIX shell and you can switch into Scheme as you wish. SCSH was intended more as a replacement for shell as a scripting language, so it doesn’t deal with the Bourne shell syntax.

        It’s too bad they didn’t copy SCSH’s process notation because that’s a really convenient way to build pipelines from Scheme. It allows you to do simple things like this:

        (define x
          (run/string (pipe (begin (print "hey")) (wc -l))))
        ;; x is now "1\n"
        

        But also more complex things like set up complex redirection:

        (define y
          (run/string (pipe+ ((1 0))
                              (pipe+ ((2 0)) (sh -c "echo foo >&2") (cat))
                              (cat))))
        ;; y is now "foo\n"
        

        The outer pipe+ redirects the first subprocess’ stdout to stdin on the second subprocess, which is the cat invocation on the last line (essentially the same as a regular pipe as above). The inner pipe+ redirects the subprocess’ stderr (which is the shell with echo foo) to stdin on the other cat.

        I know, the examples are a bit contrived but it shows you how the syntax gets you quite close to the bourne shell’s expressivity without too much hassle and no need to manually construct pipe objects and closing file descriptors in the subprocess and such. You don’t even need any explicit calls to fork.

        For CHICKEN, this syntax is available in the scsh-process egg

        1. 2

          This seems somewhat more promising to me, because my attempts to set up a pure lisp-based shell ended up with me reverting to zsh mainly because of ergonomics of just adding stuff to the end as opposed to paying at least a minimal attention to the parens in the process; here the rule of syntax switching might work out better…