Stream: ideas

Topic: Bash Here Documents


view this post on Zulip MagicMan (Oct 02 2026 at 22:29):

I was thinking about posting this for a while. But, a recent post reminded me that this might not be a bad idea.

Since a lot of popular tools and scripting languages can read from stdin so they can support Bash Here Documents. E.g. Python, Ruby, Bash, Javascript, Rscript, Julia, cat, ssh, sqlite, PostgressSQL, Lua, etc.

python3 <<EOF
print("Hello, world!")
EOF

Wouldn't it be cool if Roc could read stdin to run a script using a script? One of Roc's stated goals is to be used as a scripting language.

This talk shows an example of taking this idea a step further with a "safe scripting" platform for writing command-line scripts.

So would it make sense to make something like this possible?

# Or `roc repl`, `roc run`, or just plain `roc`.
roc script <<EOF
main! = |_| {
    echo!("Hello, World!\n")
    Ok({})
}
EOF

Last updated: Oct 15 2026 at 17:56 UTC