cyclone icon indicating copy to clipboard operation
cyclone copied to clipboard

(exit) requiring arguments when compiled

Open Retropikzel opened this issue 1 year ago • 2 comments

When script is compiled, run and it constains call to exit without arguments an error is thrown:

Error: Expected at least 1 arguments to exit but received 0:

I've made an reproducable example here https://github.com/Retropikzel/cyclone-bug-reporting, but it should be quite trivial to repoduce it manually.

The example is run with: bash exit-args.sh

R7RS says about exit on page 60: If no argument is supplied, or if obj is #t, the exit procedure should communicate to the operating system that the program exited normally.

Retropikzel avatar Aug 11 '24 07:08 Retropikzel

Thanks for the report! I was hoping this would be a quick fix but there are complications with how exit is implemented in the runtime. Still, will take a closer look...

justinethier avatar Aug 20 '24 01:08 justinethier

The problem here is that exit is currently a primitive that cannot easily be modified to be a variadic procedure, due to implementation reasons. The right solution is to:

  • Convert the primitive exit to an implementation-specific primitive (_exit, halt or such), assuming we still need this functionality as a primitive.
  • Add a full implementation of exit to the process-context library where it belongs.

justinethier avatar Aug 22 '24 02:08 justinethier