Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][tlug] Constructed state, unit tests and REPLs
- Date: Thu, 3 Sep 2020 14:43:05 +0900
- From: "Curt J. Sampson" <cjs@example.com>
- Subject: [tlug] Constructed state, unit tests and REPLs
- References: <20200831171027.4d3jbxefkczumgnz@iambic.cynic.net> <24398.34705.508876.43187@turnbull.sk.tsukuba.ac.jp> <20200902032052.c6trw45pkb6gizaz@iambic.cynic.net> <CAFv52OC=9M9Cf2nP_3K6HjbXhavwn1dmsedDwgKL2YLH4GekMA@mail.gmail.com> <20200902054202.qhfw6qbvioknhtnj@iambic.cynic.net> <CAFv52ODmPrjNWhv=Jb0jCyKzeNzmC=z0ZUc2nYZpcAZQ9ngtnQ@mail.gmail.com> <20200902093757.svg2xq65mxifbwrx@iambic.cynic.net> <CAFv52OCDhzXHk-PvopEEQYJERMBhVc-Ssw-TMGpaiyDjySOW8g@mail.gmail.com> <20200902142538.aaccpz5z2ljo7ieh@iambic.cynic.net> <CAFv52OB1e1RN+q9q0Y5iiJ1zG3FHas+uOC4mpZYmTgfmWYhKjA@mail.gmail.com>
- User-agent: NeoMutt/20170113 (1.7.2)
On 2020-09-03 06:49 +0200 (Thu), Josh Glover wrote: > I've used the GHCI REPL a little bit, but I'm certainly not an expert user, > so I may be wrong here, but it isn't possible to reload code without losing > your state, is it? Sure, but if you've changed your data structures the old state isn't valid anymore, anyway. > The way I use a lisp REPL... often means executing code to build some > state, then being able to evaluate forms in the context of my running > program to try things out and develop my code incrementally.... Well, your unit tests also have to build that state, so if you want a chunk of state that's a bunch of work to construct, you can just call the unit test function that builds that. In fact, this is why I generally don't use REPLs at all (except for looking up documentation) in languages like Python: it's usually easier and faster to write or tweak a test that does whatever little experimentation I want to do than to type it in by hand into a REPL. (It's definitely a lot faster the _second_ time I want to run it.) The same goes for things like examining intermediate state: just whack a `print` into your function and look at what the output is. The main reason I used the REPL a fair amount when coding in Haskell was that I had so few unit tests. :-) > Again, this might be just a case of the poor craftsman (me) not > understanding how to use his tools... ;) Well, you _could_ describe it that way, but I don't think it would be a particularly fair description. It would be better to say that there are other techniques to do many of the things that developers currently do in REPLs, but those techniques simply aren't as well-known or widespread. One reason for this would probably be that comprehensive unit testing became widely known only after the "test it by hand in a REPL" technique had been long established, so certain techniques have yet to be generally updated to fit into this new world. cjs -- Curt J. Sampson <cjs@example.com> +81 90 7737 2974 To iterate is human, to recurse divine. - L Peter Deutsch
- Follow-Ups:
- Re: [tlug] Constructed state, unit tests and REPLs
- From: Josh Glover
- [tlug] Constructed state, unit tests and REPLs
- From: Stephen J. Turnbull
- References:
- Re: [tlug] "Go Considered Harmful"
- From: Curt J. Sampson
- Re: [tlug] "Go Considered Harmful"
- From: Stephen J. Turnbull
- Re: [tlug] "Go Considered Harmful"
- From: Curt J. Sampson
- Re: [tlug] "Go Considered Harmful"
- From: Josh Glover
- Re: [tlug] "Go Considered Harmful"
- From: Curt J. Sampson
- Re: [tlug] "Go Considered Harmful"
- From: Josh Glover
- Re: [tlug] "Go Considered Harmful"
- From: Curt J. Sampson
- Re: [tlug] "Go Considered Harmful"
- From: Josh Glover
- Re: [tlug] "Go Considered Harmful"
- From: Curt J. Sampson
- Re: [tlug] "Go Considered Harmful"
- From: Josh Glover
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] "Go Considered Harmful"
- Next by Date: Re: [tlug] Constructed state, unit tests and REPLs
- Previous by thread: Re: [tlug] "Go Considered Harmful"
- Next by thread: Re: [tlug] Constructed state, unit tests and REPLs
- Index(es):