5 ms·
Yeah, that fixes the readline situation. Still, if has to type everything in one line for it to evaluate, the REPL isn't of much use is it?
by scriptdevil 11y ago
Yeah, that fixes the readline situation. Still, if has to type everything in one line for it to evaluate, the REPL isn't of much use is it?
- b2gills 11y agoI use rlwrap instead. The REPL is one of the features that hasn't gotten as much attention as it should. It was much more important to spend the time getting the rest of the language into shape. That said I use the REPL for 90% of my coding. Including temporarily replacing parts of the runtime while trying to fix them.
- zoffix222 11y agoNo idea :) In my 16-year programming career I never used a REPL of any sort. Just pop up a temp file and edit it with $editor-of-choice? XD
- SwellJoe 11y agoI thought that way until I worked with iPython for a while (back when it was primarily a clever REPL, and didn't really have the "notebooks" feature at all, yet, I don't think...this was back when it was new). Having a really strong REPL when debugging is like having a rocket, when you're used to having a hot air balloon. I've always been bothered by the weakness of Perl REPLs. It's only recently started to improve (in the past five years or so) for Perl 5, but there are some decent ones, though nothing even in the same league as iPython.
- Ultimatt 11y agoWell there's also a debugger for Rakudo. One that will even step through grammar/regex as they parse which is really nice. https://github.com/jnthn/rakudo-debugger https://github.com/jnthn/rakudo-debugger and https://github.com/jnthn/grammar-debugger https://github.com/jnthn/grammar-debugger
- SwellJoe 11y agoThat looks really nice. And I like that it defaults to doing the right thing. I always have to read the docs when using gdb, as it happens so rarely that I forget the commands for doing things...and it definitely does not default to useful behaviors, certainly not just hitting "enter" to do the next obvious thing. A debugger doesn't take the place of a good REPL, but it's a useful component of a good REPL.
- collyw 11y agoReally? I always see a debugger > REPL. In what ways do you see a REPL as being more powerful?
- SwellJoe 11y agoNot necessarily just from a debugging perspective (though I did mention debugging, specifically, above), but from an exploratory programming perspective. The ability to start with a snippet of something, and then trying new things. I often don't know how to solve something until I've tried several ways of doing it. A REPL (a really functional one like iPython, or, I imagine the better Lisp or Smalltalk REPLs, though I've rarely used either language) is a really nice way of doing that. A debugger, in my mind, is for running the program as it exists on disk and then inspecting it. A REPL is for interactively writing a new program. It is a different way of thinking about programming. On one hand it's something you do first in your editor and then you fix the bugs in the debugger. On the other hand, it's something you tinker with until you're happy and then you commit it to disk. Even when I worked in Python, I would mostly write the code in vim, but when I was trying to understand a new library or sort out the right data structure or algorithm for something I'd use the REPL. I guess the lines are blurry. iPython is called a Python shell, or was when I was using it. So, saying "REPL" may be misleading, if your vision of a REPL is merely "it executes a statement". You can build up quite complex functions in iPython and execute them on arbitrary data. It doesn't restrict you to one-liners. If the Perl 6 debugger allows defining new functions (and other stuff beyond merely tweaking data), then it's probably in a similar category, if still immature.
- 11y ago
- collyw 11y agoI personally find REPLs overrated. Give me a step through debugger any day (something I see fewer and fewer new programmers using these days).
- SwellJoe 11y agoIt is not either/or. I think there is simply a miscommunication happening here, where folks unfamiliar with iPython are assuming it is a simple REPL (like the Perl debugger in REPL mode. I'm not talking about a dumb thing that executes one line of code and returns. iPython (and, again, I imagine the better Lisp and SmallTalk REPLs) is a full shell with your programming environment available, including the ability to use the debugger interactively, explore your data structures, etc. But, you can also create new functions, modify existing ones, and it has command history, etc. All the stuff you'd expect of a good shell, but in Python and with a complete picture of your program's execution environment. I've simply never felt like I was able to get inside of a program like when working with iPython, and I'm not at all a good Python programmer.
- berntb 11y agoIn bash I use a few aliases (which load different libraries for DB and specific data structures) for perl -E I have simple shell aliases to do SQL queries and pipe the output to shell aliases which transform that to perl data structures (along with some project specific data structures). And so on. (The bash ctrl-R backward searches rarely interact between shell commands and searches for these one liners.) Please stop shaking your head. :-) I agree that the old lisps I used back at Uni was neater than this one liner craziness. I've thought of trying a REPL instead, but with one liners I can also use the bash functionality for processing files and so on.
- collyw 11y agoThats pretty much the same things that I would do using an IDE and step through debugger. I find an IDE far more convinient to navigate, but maybe thats just familiarity.