allison-casey / HyREPL

NREPL for Hy
MIT License
114 stars 15 forks source link

HyREPL broken features #41

Open peaceamongworlds opened 3 years ago

peaceamongworlds commented 3 years ago

Hopefully we can get some more interest in this project now :)

Having looked at the code, it seems to me that there are a few issues currently:

  1. Global / local namespaces are broken. The current use of the eval function leaks things to the wrong scope and sometimes fails to import functions from Hy core.
  2. Sessions are broken. It seems that currently the running repl executes everything in the same environment, even if you specify a different session.
  3. Interrupt operation just doesn't work.
  4. There also seems to be something wrong with setup.py. I couldn't install the package using pip, but maybe I'm just installing hy modules incorrectly.
peaceamongworlds commented 3 years ago

My ideas for how to go about fixing things:

  1. It seems to me that if you want to emulate a repl in Python, then you have to use code. Maybe we can repurpose the hy cmdline repl for this.
  2. This seems fairly straightforward to fix by having a separate namespace for each session.
  3. I don't know what to do about this because python just doesn't have a guaranteed way of killing a thread. It seems like the standard solution is to have your thread check for an interrupt signal while doing work, but given that the repl might be executing arbitrary code from the client, this isn't possible.
  4. I'm not sure how to do this, but this just seems like a technical issue.