Devlog: UCL - Comparing UCL To Some Early Ideas
I was browsing through some very old notes I had when I came across one that contain an idea for a hypothetical shell-like command language, sort of what UCL was designed for. It was designed for a project called Nuget, which was a CLI torrent downloader (now defunct). Much like UCL, it was REPL based with a simple token-based command language, and I was thinking of ways to extend this to including scripting. Here’s the note in full:
The nuget command language will be something very similar to shell. It will be used to configure nuget (in an RC file), and configure extensions.
Example - check that the VPN is running
let piaCtlState = !piactl get connectionstate if eval 'trim(${piaCtlState}) ne "Connected"' { notice "Warn: VPN not connected. Use 'piactl' to connect" } on newjob { on done { echo "Job done: ${job}" } }
I never implemented this language, opting to simply use TCL. But it’s interesting to see the desire of having an embeddable language for both REPLs and scripting alive and well back in February 2021 (the note’s datestamp).
Assuming that UCL existed at the time, I image the script would’ve looked a little less TCL-ly and a little closer to how Go templates work. Maybe something likes the following, assuming that the built-ins were implemented:
piaCtlState = os:shell "piactl get connectionstate"
if (ne (strs:trim $piaCtlState) "Connected") {
notice "Warn: VPN not connected. Use 'piactl' to connect"
}
# I'm guessing 'on' in the original idea would have job as a global variable.
# UCL can simply pass it in as an argument.
on newjob { |job|
on done { echo "Job done: $job" }
}