Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a "REPL" in javascript? [closed]

I saw a reference to creating a "REPL". What is a REPL?

var arDrone = require('ar-drone'); var client  = arDrone.createClient(); client.createRepl(); 
like image 411
Mark Harrison Avatar asked Nov 28 '12 10:11

Mark Harrison


People also ask

What is the REPL in JavaScript?

js Read-Eval-Print-Loop (REPL) is an easy-to-use command-line tool, used for processing Node. js expressions. It captures the user's JavaScript code inputs, interprets, and evaluates the result of this code. It displays the result to the screen, and repeats the process till the user quits the shell.

What does a REPL do?

A Read-Eval-Print Loop, or REPL, is a computer environment where user inputs are read and evaluated, and then the results are returned to the user. REPLs provide an interactive environment to explore tools available in specific environments or programming languages.

How do I open a REPL?

Starting the REPL is simple - just run node on the command line without a filename. It then drops you into a simple prompt ('>') where you can type any JavaScript command you wish. As in most shells, you can press the up and down arrow keys to scroll through your command history and modify previous commands.

What is REPL and how do you use it?

Note: REPL stands for Read Evaluate Print Loop, and it is a programming language environment (basically a console window) that takes single expression as user input and returns the result back to the console after execution. The REPL session provides a convenient way to quickly test simple JavaScript code.


2 Answers

Good information in the repl tag right here on Stack Overflow:

About read-eval-print-loop

A Read-Eval-Print Loop (REPL) is an interactive interpreter to a programming language. It originated with LISP systems, but many other languages (Python, Ruby, Haskell, Tcl, etc.) use REPL's to manage interactive sessions. They allow for simple experimentation with a language by bypassing the compile stage of the "code -> compile -> execute" cycle.

There are 4 components to a REPL (named in LISP notation):

  • A read function, which reads input from the keyboard
  • An eval function, which evaluates code passed to it
  • A print function, which formats and displays results
  • A loop function, which runs the three previous commands until termination
like image 107
tomlogic Avatar answered Oct 05 '22 11:10

tomlogic


The first Google hit gives you the definition on Wikipedia: REPL stands for read–eval–print loop:

A read–eval–print loop (REPL) is a simple, interactive computer programming environment.

In short, it starts an interactive console where you can type in commands and immediately see the result of these commands.

like image 25
Konrad Rudolph Avatar answered Oct 05 '22 11:10

Konrad Rudolph