pixie-lang / dust

Magic fairy dust for pixie, i.e. tooling around the language.
GNU Lesser General Public License v3.0
93 stars 14 forks source link

Exitting problems #21

Open MatthewWest opened 9 years ago

MatthewWest commented 9 years ago

Not sure if here or pixie is the correct place for this. Two issues:

  1. Exiting using Ctrl-D doesn't actually exit, but just prints out a new prompt
  2. The exit function should at least be multivalent to default to exit status of 0, even better would be if dust recognized the keyword "exit" and just exited when it saw that, without having to call the pixie (exit 0) function.
heyLu commented 9 years ago
  1. It works for me on Linux. Does it work in pixie-vm? (More things to try: does it work without rlwrap? Does Ctrl-C work?)
  2. I've submitted pixie-lang/pixie#298 for that. When it gets merged, the expression :exit will close the repl.
MatthewWest commented 9 years ago

@heyLu

  1. It does work in pixie-vm, not in dust. 2. I think it'd be preferable to have exit the symbol be recognized, rather than the keyword. The reason is that keywords are generally not reserved, and since they can be used as a function (at least in clojure) into a map, it isn't a good idea to make evaluating a special keyword exit. Rather, we could provide a special check in dust whether a line is only "exit". It isn't necessary to do in pixie itself, I don't think.

Edit: I read the pull request and changed my mind about point 2.

MatthewWest commented 9 years ago

@heyLu I just checked with rlwrap pixie-vm, and it has the same problem as dust with not exiting on Ctrl-D, so this appears to be an issue with rlwrap. However, if I do rlwrap bash I can close it with Ctrl-D, so the problem appears to be in the intersection of rlwrap and pixie-vm.

heyLu commented 9 years ago

dust actually invokes rlwrap -aignored -n pixie-vm, can you try that with bash and pixie-vm? It may also be Mac OS X specific, as it works on my machine, which runs Linux.

MatthewWest commented 9 years ago

I tried it on both pixie-vm and bash, and it has the same issues. The interesting thing is that bash explicitly says exit when I enter Ctrl-D, as if I had typed that command. Maybe the problem can be addressed in pixie-vm’s main loop, looking for Ctrl-D in a different way? I’ll take a look at what’s currently going on.

On Apr 23, 2015, at 2:09 PM, Lucas Stadler notifications@github.com wrote:

dust actually invokes rlwrap -aignored -n pixie-vm, can you try that with bash and pixie-vm? It may also be Mac OS X specific, as it works on my machine, which runs Linux.

— Reply to this email directly or view it on GitHub https://github.com/pixie-lang/dust/issues/21#issuecomment-95673982.

daveyarwood commented 9 years ago

I can reproduce the same problem on my Macbook. Pressing Ctrl-D doesn't exit, it shows the prompt again on the same line, e.g. (pressing ^D a few times)

user => user => user => user =>

Running rlwrap dust doesn't help.

Interestingly, pixie-vm exits with Ctrl-D out of the box, no need for rlwrap, and I have command history available to me. Has rlwrap been rolled into Pixie since this issue was created?

heyLu commented 9 years ago

I still don't know what the problem is, and I have no mac to try and fix it.

Since pixie-lang/pixie#379 Pixie's repl has history support built-in.

daveyarwood commented 9 years ago

I forgot to mention, Ctrl-C does close the Dust REPL for me. So, it's not really a show-stopper as far as I can tell. It must be something to do with the way that the ^D signal is sent for Linux vs. OS X.

thomasmulvaney commented 9 years ago

Should we remove rlwrap now that we have build in history?

heyLu commented 9 years ago

I don't think so, at least not yet. The built-in history is not persistent across runs of pixie-vm, but the one in rlwrap is. In addition, rlwrap has some support for paren-matching, which I find quite helpful.