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
This commit is contained in:
15
issues/17-underscore-scope.md
Normal file
15
issues/17-underscore-scope.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# 17 — `_` is global rather than local
|
||||
|
||||
**Status:** open
|
||||
|
||||
The `_` result variable from interactive commands (`!cmd`) is set as a global via `lua_setglobal(L, "_")`. This has several implications:
|
||||
|
||||
- It can escape its scope and pollute other scopes
|
||||
- A function may silently overwrite `_` if it uses shell commands internally, surprising the caller
|
||||
- Lua convention uses `_` as a throwaway variable in `for` loops (`for _, v in pairs(t)`)
|
||||
|
||||
## Investigation needed
|
||||
|
||||
- What are the concrete consequences of `_` being global vs local?
|
||||
- Can we make it local to the REPL line instead?
|
||||
- Should we use a different name entirely?
|
||||
Reference in New Issue
Block a user