If you're a longtime repl.it user you've probably noticed that some languages start behaving differently (or weirdly) when you add the first additional file. That's what we called "project vs eval" modes. Many users -- including me -- resorted to adding an empty file (e.g.
_.js) just to make it behave as expected (which is gross and ugly).
But after you added any additional files you lose some interactive functionality:
- it doesn't have access to the project scope
- if you start a server the console stop working altogether
Also, in Node.js things like
chalk or colors didn't work by default (you had to force it or open it in repl.run).
Well, all this is now fixed. Node.js now ships with:
- full ANSI terminal with colors and all that (example https://repl.it/@amasad/ink-example)
- the native Node.js console with a bunch of useful commands (commands here https://nodejs.org/api/repl.html#repl_commands_and_special_keys)
This should solve a lot of problems people reported in the past. Let me know if you have any feedback!
Is a similar fix for eval mode vs project mode planned for Python or other languages? And what's the reationale for the separation between eval and project mode anyway?
@PaoloAmoroso It's been fixed for Python for a while now. Are you seeing any issues?
Original reason for the distinction is that the way we wrote our repls where basically just running
eval inside the language interpreter. When we added files that makes it hard to
eval (eval doesn't have the concept of files) so we had to just run the code as is.
The new behavior is unlocked by https://github.com/replit/prybar, which for the most part operates on an internal level (either via C binding or something similar)