There's More Than One Way To Do It

binding.pry by many programming languages

Comparison of process interruption tool

What is binding.pry?

While debugging, the engineers sometimes want to see the variable values at that point. If your language is static and you use IDE, you can set break point by GUI tools. However, if you use a scripting language with a pure text editor, we cannot take it the same way.

Open REPL and run each line might be possible, but it's a hassle. On Ruby, inserting binding.pry or binding.irb can launch REPL at a specific point. I share how we can do the same thing for the other languages.


After gem install pry

require 'pry'
a = 1
b = 2
binding.pry # open REPL
puts a+b

Since Ruby 2.4, native irb supports similar feature

require 'irb'
a = 1
b = 2
binding.irb # open REPL
puts a+b


pip install ipython

from IPython import embed
a = 1
b = 2
embed() # open REPL


Style is different. node inspect test.js

a = 1;
b = 2;
debugger; // breakpoint

At launch time, the cursor is on the head of the script. Move to the breakpoint.

debug> cont // Continue to breakpoint
debug> repl // Open REPL


composer require psy/psysh

require 'vendor/autoload.php';

$a = 1;
$b = 2;
eval(\Psy\sh()); // open REPL
echo $a+$b;
echo "\n";


Node.js's style is unique.