#16 multiline shell commands #17 _ scope (global vs local) #18 path expansion (~) #19 nested commands trigger prompt2 #20 simplify backtick return value #21 prompt redesign #22 implicit interactive commands (drop ! prefix) #23 general cleanup and refactor
922 B
922 B
22 — Implicit interactive commands (drop ! prefix)
Status: open
In the REPL, maybe we can get away with not needing the ! prefix.
Lua already attempts to run input as a statement. If that fails, it assumes it might be an expression (e.g. 1 + 2) and wraps it in return(...). If that also fails, we could try wrapping it with ! prefix semantics as a third fallback.
Execution order
- Try as Lua statement
- Try as Lua expression (
return ...) - Try as shell command (interactive execution)
Considerations
- Ambiguity:
lsis not valid Lua, so it would fall through to shell — this is the desired behaviour - But
printis valid Lua (it's a value) — soprintalone wouldn't trigger shell - What about
git status? Not valid Lua, would correctly fall through to shell - Error messages: if all three fail, which error do we show?
- Performance: three parse attempts per input line