Re:John Carmack on Parallel Implementations (2018)
by FullyFunctional on Friday August 02, 2019 @01:01AM
(#20590742)
I recently learned from Tristan’s blog [1] about a similar feature in Rust [2]. I can’t wait to try it out.
[1] http://thume.ca/2019/04/18/writing-a-compiler-in-rust/ [2] https://github.com/mitsuhiko/insta
Re:John Carmack on Parallel Implementations (2018)
by hyperpallium on Friday August 02, 2019 @10:29PM
(#20598265)
Have your test and not write it too.
Very appealing, but one problem I've found with this general idea is equivalent but non-identical results. A simply-solved example is a serialized set: different orderings differ, but are equivalent. You can get more complex ones, such as ASTs ax+bx and (a+b)x.
Such cases should be pretty rare, but they come up for me all the time.
It allows you to perform black-box testing, recording and replaying test data (gathered from production).
From there you can refactor your code and even have the library run both new/old codepaths in production, raising errors if there is a mismatch.
To your point about constant rewrites, I think using a library like this while continuously refactoring existing code is a pretty exciting idea.
Too bad I need a Java version (maybe a good idea for a side-project).
[1] https://github.com/testdouble/suture