Proper use of REPL for development

I always wondered how to properly use REPL to write reusable code, as opposed to one-time experiments. There are strong opinions about the various advantages of the REPL development style, and I would like to test this in practice, but I do not understand what the expected workflow will be.

Suppose that I open an existing module (+ sample / test data) in REPL and interactively create a new function / fix the error. Great success - now he frobnicates foobar, as expected! But what now? How can I get changes and additions back to my modules (modules) and versioncontrol?

Dropping the REPL state into the file will work only for the initial creation, and not for modifying or adding to the existing code (for example, in almost all development) - it needs to save such things as separation between modules, comments, etc. Copying from the REPL history to the appropriate places in each file seems like a tedious job and is very error prone. How can I guarantee that the changed functions have the exact final version that I had in the REPL, and that I did not forget it?

What is the recommended recommendation for this?

IMHO the question does not depend on the language, but if not, let's say that Haskell or Python, since Lisp is its own world, and I am not familiar with it.

+4
source share
1 answer

REPL . REPL :

  • .
  • .
  • adhoc.

, LOAD SAVE, Microsoft ROM, BASIC, 1970- 1980- . , , , , , .

REPL , bash. , , . .

, , , . , HUnit for Haskell unittest Python, .

, , REPL, , .

+3

Source: https://habr.com/ru/post/1531911/


All Articles