Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add REPL #779

Closed
kyranet opened this issue Sep 21, 2018 · 11 comments
Closed

Add REPL #779

kyranet opened this issue Sep 21, 2018 · 11 comments

Comments

@kyranet
Copy link
Contributor

kyranet commented Sep 21, 2018

It would be very nice to have a REPL in deno, which would help us to test code quickly. Currently, it exits the process with error code 1 and the message "No input script specified.".

@ry
Copy link
Member

ry commented Sep 21, 2018

Yes definitely. I’d like to wait until a couple of important refactors are landed before trying to do the REPL: #733 and #721

There’s some debate as to whether we should use a readline/repl library from rust or develop our own in JS (as we did in node). I am leaning towards using a rust lib...

(I also would like to have a command line debugger like node debug. It’s one of my major regrets that the CLI debugger in Node had very little improvements after I made it. It is still buggy and barely usable. We can fix that here.)

@ry
Copy link
Member

ry commented Sep 30, 2018

Both of the above mentioned issues are now solved. I'm open to patches for REPL now.

Thoughts:

  • I think this should be done using a Rust readline crate (e.g. https://github.com/kkawakam/rustyline). Discuss in this issue first which crate you would use.
  • I am open to a pure JS implementation, but skeptical that this can be done more easily than with a rust lib.
  • Windows must be supported.
  • Each eval could be done using Isolate::execute()
  • We don't need to support TS for the first version.

@cedric05
Copy link
Contributor

cedric05 commented Oct 6, 2018

will try to implement. i'm new to this, don't stop because of me

@cedric05
Copy link
Contributor

cedric05 commented Oct 8, 2018

couldn't add rustyline to third_party, is there an easy way to add new packages to existing deno project. generating rlib is one heck of thing, couldn't figure out with present build.gn files

@cedric05
Copy link
Contributor

cedric05 commented Oct 8, 2018

came across https://github.com/sfackler/cargo-tree, which will print dependencies in tree, will try to change build files.

@cedric05
Copy link
Contributor

cedric05 commented Oct 9, 2018

using rustyline i created a repl loop, but i'm not able to import any deno modules/functions defined in deno.ts . how can we import them from pure js runtime ?

for reference branch: https://github.com/denoland/deno/compare/master...cedric05:repl?expand=1
deno_third_party: https://github.com/denoland/deno_third_party/compare/master...cedric05:master?expand=1
changes
@ry

@ry
Copy link
Member

ry commented Oct 9, 2018

@cedric05 cool! we will have to hook into the ES module import hooks in V8 or pass the input thru TS... if you upload your patch as a PR, I’ll take a look and provide some more concrete guidance

@cedric05
Copy link
Contributor

cedric05 commented Oct 9, 2018

i can raise pr, but this is half baked

@ry
Copy link
Member

ry commented Oct 9, 2018

@cedric05 that’s fine - just add WIP to the title

@cedric05
Copy link
Contributor

cedric05 commented Oct 9, 2018

raised #947.

@kitsonk
Copy link
Contributor

kitsonk commented Nov 7, 2018

This can be closed. We should handle any enhancements to the REPL under different issues.

@ry ry closed this as completed Nov 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants