Files
lush/issues/20-backtick-return-value.md
Cormac Shannon 9e75175c79 Add issues #16–#23
#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
2026-03-04 23:28:11 +00:00

30 lines
940 B
Markdown

# 20 — Simplify backtick return value
**Status:** open
Currently backtick expressions return a table `{code, stdout, stderr}`, requiring verbose access:
```lua
!echo ${`ls`.stdout}
```
This is explicit but noisy for the common case. Consider making backticks return stdout directly, with the full result table still available via `_`:
```lua
-- backtick returns stdout string directly
local files = `ls`
-- full result still available in _
print(_.code)
print(_.stderr)
```
## Considerations
- This would be a breaking change to current backtick semantics
- The table is still useful when you need exit code or stderr
- Could we return multiple values? `stdout, result_table = \`cmd\``
- How does this interact with pipelines where you chain results?
- This would unify the interface/behaviour of backticks and ! commands, both set the majority of their data to `_`
- Main difference is where do they output their stdout & stderr