Remix.run Logo
uticus 3 hours ago

https://re-bol.com/short_rebol_examples.r for some examples of the language (from https://redprogramming.com/Home.html)

em-bee 2 hours ago | parent [-]

i'd be curious if red can be used as a commandline shell. the syntax should work well with it. it may just need some wrapper functions to be able to call external programs, pass arguments to them and capture the output.

klibertp an hour ago | parent [-]

Not sure why it wouldn't be usable for that:

    -▶ ./red-cli-066
    --== Red 0.6.6 ==--
    Type HELP for starting information.

    >> call/console "echo 123"
    123
    == 0
    >> call/console "pwd"
    /home/cji/portless
    == 0
`call` has a bunch of refinements (toggles or switches appended to the function name with a slash; I'm using /console to redirect output to the parent's stdout), but it's a pretty low-level interface. You definitely could define a few simple helpers and get to a usable Unix-like shell pretty quickly. You'd get native AOT compilation for all your shell scripts for free.

The problem is that you could write those helpers in just about any language, and while Red has an edge over many due to the regular and simple syntax, it's by no means unique in that regard (TCL is an obvious alternative, Lisp-likes are also strong, and even Smalltalk could join the chat if you don't care too much about startup time). And 32-bit-only thing doesn't look good, even if it's not an actual problem in most cases.

In short: it can, but why would you? (Don't get me wrong: I like Red! But with so many other interesting languages (if you're willing to look past TIOBE Top 20), it's hard to justify investing more time into learning Red in particular.)

ulbu 27 minutes ago | parent [-]

I think they mean red as a shell scripting/command line language.