gkz / LiveScript

LiveScript is a language which compiles to JavaScript. It has a straightforward mapping to JavaScript and allows you to write expressive code devoid of repetitive boilerplate. While LiveScript adds many features to assist in functional style programming, it also has many improvements for object oriented and imperative programming.
http://livescript.net
MIT License
2.31k stars 156 forks source link

Feature request: REPL commands #1090

Open bmundt6 opened 4 years ago

bmundt6 commented 4 years ago

Node allows the use of dot-first keywords as commands in the REPL, such as .load script.js: https://nodejs.org/api/repl.html#repl_commands_and_special_keys

It would be nice to have functions implementing each of the commands for use in the repl - they don't actually need to use special syntax, since LiveScript already has command-like syntax for functions (e.g. could have a simple function load = (filename) -> ...).

rhendric commented 4 years ago

LiveScript's REPL only uses the Node.js REPL for tab completion; the actual interface you interact with is a custom Readline frontend backed by the vm module. So any commands you want would have to be implemented from scratch.

Are there any that would be especially useful to you? The LS REPL already has a few special functions exposed; I'm not fundamentally opposed to adding more, but some of those commands look like they'd be tricky to reproduce faithfully.

bmundt6 commented 4 years ago

The main two that I use are .load and .save. .help and .clear are also very useful but not as much to me.