-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
REPL emits surprising output on > {a: 1}
#1421
Comments
if compatible with most platforms, it should return in Chrome repl outputs in Node.js
Chrome:
Should we refer to chrome? @kevinkassimo |
@justjavac Ideally we should. However, I think the behavior of Node is much easier to implement by simply introducing 2 tries, first with wrapping parentheses and second without. On the other hand, Node internally uses acorn to do some JS parsing to determine the best handling approach. I would say we might want to keep things simpler for Deno at current stage... |
keep things simpler for developers |
@justjavac Eventually we should... but we would also need better infra for that... There are still a bunch of more important improvements we need to introduce to REPL... It's more about prioritization and iterations... |
Yeah I mean, the fact I can't even paste a Typescript function without it puking makes the REPL kind of useless for me. I find myself constantly switching back to Node and I'm only a few days into evaluating Deno.
Most of the time in the REPL I'm going to be running expressions - I want to see how the engine evaluates something. Doing hacks is not something I'd hope Deno to do, but instead looking at the AST and figuring out whether or not the input is an expression is something I think makes a lot of sense. |
I don't see how using an AST pass to determine the node type would constitute as "complex". I see it as "correct", however, and anything less correct than that feels like Deno cutting corners and going down a similar path that Node did. Not the quality I expected from Deno. Might as well keep using Node at that point. |
Please feel free. |
@Qix- Deno is not stable yet. It took Node many years to reach the quality today, and we cannot expect everything would suddenly miraculously work for Deno. (REPL is just one thing. There are many more things to worry about atm (e.g. strong Web spec compliance related work). Check PRs to see what is going on with the focus of the team) Node is solid, and definitely continue use Node for very serious purposes for the time being. Also I think Bartek is making some experiments right now (following the path of ts-node) #3760 |
Currently,
Expected:
This is due to v8 considering
{}
as a scope instead of object.In Node, this is solved by secretly adding a pair of parentheses around the object, like
The code implementing this is available here:
https://github.com/nodejs/node/blob/ae73b73eeb99101188c860cce488ccc085b2f268/lib/repl.js#L235-L243
I am expecting a similar patch for this after #1407 and #1420 are landed...
The text was updated successfully, but these errors were encountered: