updated hseval behavior

This commit is contained in:
Luxferre
2026-07-04 16:09:50 +03:00
parent 1a44245078
commit 257d40dc8d
3 changed files with 34 additions and 6 deletions
+5 -3
View File
@@ -313,11 +313,13 @@ Any line fragment starting with `#` to the end of the physical source line is re
**N.B.**: on the platforms that don't support specifying process exit codes, this primitive may either do nothing, exit the program the usual way supported by the platform or trigger a global interpreter restart.
### `hseval` (Host Language Evaluation)
### `hseval` (Host Evaluation / Execution)
- **Stack Effect**: `( expr -- val )`
- **Description**: Pops the string `expr` from the stack, evaluates it as an expression in the host language (e.g., Python), and pushes the resulting value back onto the stack.
- **Description**: Pops the string `expr` from the stack and evaluates or executes it in the host environment.
- In the Python implementation, it evaluates `expr` as a Python expression and pushes the resulting value back onto the stack.
- In the Go implementation, it executes `expr` as a system shell command, redirects its stdin/stdout/stderr to the current process, and pushes the command's exit code back onto the stack.
**N.B.**: this primitive may not be supported on all targets. Only use as a last resort in controlled and/or sandboxed environments. Never pass user input to this primitive.
**N.B.**: this primitive may not be supported on all targets, and its behavior varies by implementation. Only use as a last resort in controlled and/or sandboxed environments. Never pass unvalidated user input to this primitive.
---