Fred Martin wrote on 02/15/2016 12:21 PM:
https://docs.racket-lang.org/reference/serialization.html, which allowed me to
save my object in my definitions buffer along Neil's suggestion. :)
Be aware that the serialize format is Racket-version-specific, so
implications for serialized values pasted into files.
Long-winded for the broader audience...
Serialization is a good option for interactive REPL stuff, *when*
simpler options won't work or would take more effort, but there are a
gotcha.
As a module shapes up, and work with it moves more from REPL to unit
tests, that particular serialization implementation (of anything that
isn't `read`-able`) will yield values that are -- this is buried in the
docs -- expressly specific to a Racket version. So you probably don't
want to use these serialized values in unit tests, which tests will tend
to be run with multiple Racket versions over time. Also, if you happen
to be a REPL power user, when you upgrade your Racket version, and some
of your REPL-oriented working files with serialized values in them might
no longer work. That's why I mentioned values that were `read`-able or
made from constructors.
And this is one way unit testing can affect how a system is decomposed
for the programming level: the desire for easy unit tests at good
granularity encourages us to have internal interface boundaries that
that facilitate standalone tests of each individual test-worthy
"piece". This unit testing influence on code structure can also give us
a fresh appreciation of pure functions, since pure functions can often
make unit tests simple and concise.
Neil V.
--
You received this message because you are subscribed to the Google Groups "Racket
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.