mattwparas / steel

An embedded scheme interpreter in Rust
Apache License 2.0
1.05k stars 49 forks source link

REPL prompt is incorrectly fed a path name even though the loading has failed #167

Closed kenaryn closed 3 months ago

kenaryn commented 6 months ago

Issue encountered using Steel v 0.5.0 1fb88e5

The REPL prompt, initially defined like so λ >, is none the less fed the newly added path name despite the loading failed. That seems to me like unintended behaviour because of the visual noise and a possible misinterpretation leading to the belief that some symbols are actually imported in the current environment.

  1. Run the Steel REPL: steel

  2. Load a wrongly named or inexistant file/path name: :load utilities.scm

  3. An non-blocking error occurs: No such file or directory (os error 2)

  4. The prompt is however fed with a non-loaded path name: λ > (utilities.scm) >

Here is the actual result on my machine: steel_repl_prompt_error

EDIT: The same issue occurs when the file tentatively loaded actually exists. Despite failing to load that said file due to a whatever compiling error, the prompt is still fed the path name, which again is an undesirable consequence.

:load <existing_file.scm> produces the following result:

λ > :load let02.scm
error[E09]: Parse
   ┌─ let02.scm:15:2
   │
15 │ (let ([x 3]
   │  ^^^ Parse: Syntax Error: let expects an expression, found none

λ (let02.scm) >

On a side note:

Could be extended to the point where we would land a full nomenclatur: notice < warning < error < fatal error.