ripl - an irb alternative - 0.3.0 released

R

Robert Klemme

ripl, a light modular alternative to irb, has reached 0.3.0. ripl
works on most major rubies (1.8.x, 1.9.x, rubinius and jruby), has a
growing plugin ecosystem of 15+ plugins and is fully documented and
tested. For more on ripl's features and advantages over irb see:

* http://github.com/cldwalker/ripl
* http://rbjl.net/44-ripl-why-should-you-use-an-irb-alternative

This looks interesting, although I would only use it if I need a shell
framework. You do not mention a few downsides of ripl:

- it is not automatically there as IRB is because it's part of a
standard Ruby installation (or present in the package system)
- users need to learn it

Also, I don't find the argument of 5,000 vs. 270 loc very appealing:
every software acquires some "weight" as it grows older. Even if
ripl's core does not gain that much - the gain then simply will be in
the plugins. Over time the loc gap will likely shrink so this is at
best a temporary argument. :)

Side note: funnily enough I have become more conservative in the
course of time; maybe it's because I see the cost of change clearer
nowadays. At least I rather invest energy in new things that are
needed than in creating replacements for things that work. Probably
I'm approaching grumpy old man state... :)

Kind regards

robert
 
Q

Quintus

Am 04.01.2011 14:55, schrieb ghorner:
ripl, a light modular alternative to irb, has reached 0.3.0. ripl
works on most major rubies (1.8.x, 1.9.x, rubinius and jruby), has a
growing plugin ecosystem of 15+ plugins and is fully documented and
tested. For more on ripl's features and advantages over irb see:

* http://github.com/cldwalker/ripl
* http://rbjl.net/44-ripl-why-should-you-use-an-irb-alternative

Thanks,
Gabriel

Maybe a new hope for embedding an interactive Ruby in my GUI
application? Some months ago, I posted on this list with the subject of
embedding IRB in my GUI application for debugging purposes or just for
users who want to have fast access to the things they're working with.
But trying to make IRB read from something else as STDIN is a real
nightmare and nearly impossible on a Windows system, not to mention
across platforms.
I'm interested. Is it possible to make ripl read from and write to an
arbitrary IO object?

Vale,
Marvin
 
R

Ryan Davis

=20
This looks interesting, although I would only use it if I need a shell
framework. You do not mention a few downsides of ripl:
=20
- it is not automatically there as IRB is because it's part of a
standard Ruby installation (or present in the package system)

So... you only advocate using 100% ruby-core + stdlib. Right.
- users need to learn it

And they didn't need to learn irb. That's a ridiculous point to try to =
make. You have to learn EVERY tool and EVERY library you use.
Also, I don't find the argument of 5,000 vs. 270 loc very appealing:
every software acquires some "weight" as it grows older. Even if
ripl's core does not gain that much - the gain then simply will be in
the plugins. Over time the loc gap will likely shrink so this is at
best a temporary argument. :)

Well, that's entirely inane. You've obviously never looked at the guts =
of irb.

IRB _started_ at 5k (actually ~7k) and has been monotonically increasing =
every since:

3063 % find ruby_1_6/lib/irb* -type f | xargs wc -l | tail -1
7779 total
3064 % find ruby_1_8_6/lib/irb* -type f | xargs wc -l | tail -1
11136 total
3065 % find ruby_1_8_7/lib/irb* -type f | xargs wc -l | tail -1
12519 total
3066 % find ruby_1_9_2/lib/irb* -type f | xargs wc -l | tail -1
16052 total

It is to the point where it is downright _painful_ to try to maintain, =
much less enhance.

If ripl starts at 270 lines, it isn't even in the same league (in a good =
way) as irb. That means that it'll be orders of magnitude easier to =
understand (more than really; the complexity in a system like this is =
probably geometric, if not exponential).
Side note: funnily enough I have become more conservative in the
course of time; maybe it's because I see the cost of change clearer
nowadays. At least I rather invest energy in new things that are
needed than in creating replacements for things that work. Probably
I'm approaching grumpy old man state... :)

apparently. grumpy irrational old man at that...=
 
R

Ryan Davis

I'm interested. Is it possible to make ripl read from and write to an
arbitrary IO object?

Luckily with it only being ~270 lines long, you can easily find what =
you're looking for:
# When extending this method, ensure your plugin disables = readline:
# Readline.config[:readline] =3D false.
# @return [String, nil] Prints #prompt and returns input given by = user
def get_input
print prompt
$stdin.gets.chomp
end
 
G

ghorner

Also, I don't find the argument of 5,000 vs. 270 loc very appealing:

The point in giving a loc comparison is to draw attention to the
needlessly complex approach irb has taken to doing something simple.
To understand and extend ripl, you only need to know that a shell
object exists and modules/plugins extend the shell's functionality.
Compare to irb ...
every software acquires some "weight" as it grows older. Even if
ripl's core does not gain that much - the gain then simply will be in
the plugins. Over time the loc gap will likely shrink so this is at
best a temporary argument. :)

I've reimplemented most of irb's functionality at this point (see
http://github.com/cldwalker/ripl-irb and http://github.com/cldwalker/ripl-misc)
and don't see it coming anywhere close to irb's complexity and loc.
Side note: funnily enough I have become more conservative in the
course of time; maybe it's because I see the cost of change clearer
nowadays. At least I rather invest energy in new things that are
needed than in creating replacements for things that work. Probably
I'm approaching grumpy old man state... :)

What is one person's necessity is another's reinventing of a good-
enough wheel. ;-)

Gabriel
 
G

ghorner

Maybe a new hope for embedding an interactive Ruby in my GUI
application? Some months ago, I posted on this list with the subject of
embedding IRB in my GUI application for debugging purposes or just for
users who want to have fast access to the things they're working with.

Should be possible. I've been able to bring ripl to the web via
websockets, http://github.com/cldwalker/nirvana.
But trying to make IRB read from something else as STDIN is a real
nightmare and nearly impossible on a Windows system, not to mention
across platforms.
I'm interested. Is it possible to make ripl read from and write to an
arbitrary IO object?

Check out the plugin ripl-play, http://github.com/cldwalker/ripl-play.
It can read from stdin, a file or a url. It can also record a ripl
session to be played back later.

Feel free to contact me or open a github issue if you need help making
a ripl plugin,
Gabriel
 
M

Martin DeMello

Maybe a new hope for embedding an interactive Ruby in my GUI
application? Some months ago, I posted on this list with the subject of
embedding IRB in my GUI application for debugging purposes or just for
users who want to have fast access to the things they're working with.
But trying to make IRB read from something else as STDIN is a real
nightmare and nearly impossible on a Windows system, not to mention
across platforms.
I'm interested. Is it possible to make ripl read from and write to an
arbitrary IO object?

Give my guirb project a look: https://github.com/martindemello/guirb

Right now there are tk and fox backends, I'm planning on adding gtk
and qt support, and would be happy to accept contributed modules for
other gui toolkits, subject to their installing painlessly on ruby 1.9

martin
 
R

Robert Klemme

So... you only advocate using 100% ruby-core + stdlib. Right.

Not exactly. I am balancing benefits and costs. For me using ripl as
replacement of IRB has zero advantages but some cost. As simple as
that.
And they didn't need to learn irb. That's a ridiculous point to try to ma=
ke. You have to learn EVERY tool and EVERY library you use.

That's not the point. Users *have* learned IRB already and to use
ripl they start learning again so this is additional overhead.
Well, that's entirely inane. You've obviously never looked at the guts of=
irb.

That's true. But why should I bother if it does what I need it to do
reasonably well?
IRB _started_ at 5k (actually ~7k) and has been monotonically increasing = every since:

3063 % find ruby_1_6/lib/irb* -type f | xargs wc -l | tail -1
=A0 =A07779 total
3064 % find ruby_1_8_6/lib/irb* -type f | xargs wc -l | tail -1
=A0 11136 total
3065 % find ruby_1_8_7/lib/irb* -type f | xargs wc -l | tail -1
=A0 12519 total
3066 % find ruby_1_9_2/lib/irb* -type f | xargs wc -l | tail -1
=A0 16052 total

It is to the point where it is downright _painful_ to try to maintain, mu=
ch less enhance.

Are you the maintainer? If not, did he / she complain?
If ripl starts at 270 lines, it isn't even in the same league (in a good =
way) as irb. That means that it'll be orders of magnitude easier to underst=
and (more than really; the complexity in a system like this is probably geo=
metric, if not exponential).
apparently. grumpy irrational old man at that...

Irrational - I don't think so. I just happen to judge according to
different values than you are.

Cheers

robert

--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
 
Q

Quintus

Am 05.01.2011 08:37, schrieb Martin DeMello:
Give my guirb project a look: https://github.com/martindemello/guirb

Right now there are tk and fox backends, I'm planning on adding gtk
and qt support, and would be happy to accept contributed modules for
other gui toolkits, subject to their installing painlessly on ruby 1.9

martin

I will have a look at it, definitely. I'm working mostly with wxRuby,
but that shouldn't prevent me from trying it out.
Check out the plugin ripl-play, http://github.com/cldwalker/ripl-play.
It can read from stdin, a file or a url. It can also record a ripl
session to be played back later.

Feel free to contact me or open a github issue if you need help making
a ripl plugin,
Gabriel

I will look into this as well (but for debugging my GUI I'll need to
pass the correct binding). Both sound good at the very beginning, let's
see how it evolves.
Luckily with it only being ~270 lines long, you can easily find what > you're looking for:
# When extending this method, ensure your plugin disables readline:
# Readline.config[:readline] = false.
# @return [String, nil] Prints #prompt and returns input given by user
def get_input
print prompt
$stdin.gets.chomp
end

Seems to be easy then.

Thanks to eveyone!

Valete,
Marvin
 
M

Michal Suchanek

Hello

There is a serious issue with ripl.

$ ripl
Bond Error: Failed to load readline_line_buffer. Ensure that it exists
and was built correctly."<11MB of junk in octal notation with no way to terminate the output>"

with irb you can press ^C to abort printing the output.

Of course, you can write
=> true

or
buf = f.read ; buf[0..10]
=> "\251\245T\344\341m\223{\351\2524"

but that's something you should not be *required* to do to use ripl.

Thanks

Michal
 
M

Michal Suchanek

Hello

How is it supposed to be used?

Installation reports no errors:

# gem install ripl
Building native extensions. This could take a while...
Successfully installed bond-0.3.4
Successfully installed ripl-0.3.0
2 gems installed
Installing ri documentation for bond-0.3.4...
Installing ri documentation for ripl-0.3.0...
Installing RDoc documentation for bond-0.3.4...
Installing RDoc documentation for ripl-0.3.0...

I symlinked the executable in my home directory because it's hidden
somewhere in lib.

$ ln -s /var/lib/gems/1.8/bin/ripl /home/hramrach/bin/

I get this:

$ ripl
Bond Error: Failed to load readline_line_buffer. Ensure that it exists
and was built correctly.
gem --version
1.3.7
ruby --version
ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]

Thanks

Michal
 
G

ghorner

Hello

There is a serious issue with ripl.

$ ripl
Bond Error: Failed to load readline_line_buffer. Ensure that it exists
and was built correctly.

For ruby < 1.9.2, you'll need to have readline installed. I'm
surprised your install reported no errors. Can you reinstall?
with irb you can press ^C to abort printing the output.

Pressing Ctrl-C to abort printing works for me. What linux distro are
you running?
I symlinked the executable in my home directory because it's hidden
somewhere in lib.

You shouldn't symlink executables to ~/bin after installing any gem.
Not sure I understand the reasoning. Executables aren't hidden in
lib/.

Gabriel
 
B

Ben Bleything

You shouldn't symlink executables to ~/bin after installing any gem.
Not sure I understand the reasoning. Executables aren't hidden in
lib/.

It is on recent debian and ubuntu with their rubygems. You can add
their bin path to your path, but it's not there by default.

Ben
 
D

Daniel Hernández

Excerpts from Michal Suchanek's message of Wed Jan 05 13:03:13 -0300 2011:
$ ripl
Bond Error: Failed to load readline_line_buffer. Ensure that it exists
and was built correctly.
gem --version
1.3.7
ruby --version
ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]

I have the same problem:

$ gem --version
1.3.6
$ ruby --version
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]

Daniel H.
 
M

Michal Suchanek

For ruby < 1.9.2, you'll need to have readline installed. I'm
surprised your install reported no errors. Can you reinstall?

I installed on another machine and do not get the error.
Pressing Ctrl-C to abort printing works for me. What linux distro are
you running?

Debian

Does not work even with the readline plugin working.
somewhere in lib.

You shouldn't symlink executables to ~/bin after installing any gem.
Not sure I understand the reasoning. Executables aren't hidden in
lib/.

Yes, they are hidden in /var/lib. It may be a Debian issue.

Thanks

Michal
 
G

ghorner

I installed on another machine and do not get the error.

If your install is building the readline_line_buffer extension
correctly, then the problem must be you can't find it. What does the
following command give you?

find $(dirname $(gem which bond)) | grep readline_line_buffer

You should get the path of the extension. Try requiring that path
after requiring ripl.
Yes, they are hidden in /var/lib. It may be a Debian issue.

I got hold of a ubuntu box, installed rubygems (because the default
rubygems can be troublesome) and executables install fine into /usr/
bin. Perhaps it is a debian-specific issue.

Gabriel
 
M

Michal Suchanek

If your install is building the readline_line_buffer extension
correctly, then the problem must be you can't find it. What does the
following command give you?

=C2=A0 find $(dirname $(gem which bond)) | grep readline_line_buffer

You should get the path of the extension. Try requiring that path
after requiring ripl.

Apparently bond requires readline development files but does not
report an error when they are not present.

Thanks

Michal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top