Search code examples
command-linereadlineread-eval-print-loopsupercollider

How do you do multiple line entry in the command line REPL of SuperCollider?


Just as the title says, How do you do multiple line entry in the command line REPL of SuperCollider? For example, in Haskell, you use :{ and :} to open and close multiple line entry in ghci.


Solution

  • If you're using sclang with the -i flag (meaning e.g. sclang -i something), the keycode to execute previously entered text is esc, followed by a newline. For example:

    ~a = {
       "test".postln;
    }^[
    ~a.();^[
    

    outputs: test

    This works file if you're driving sclang from an IDE or another scripting context (this is used for sclang's unit tests). If you're using the repl, it appears that there ISN'T a way to do multiline entries - the repl uses readline which doesn't have multiline support out of the box. This should probably be filed as a bug.