After a great suggestion by Vojta about adding dependencies between code snippets I’ve gone ahead and did just that. I’m using a tagging system to manage dependencies. Usually you’d manage dependencies in your code by separating big pieces of code into separate functions. You can do the same with shred. Add each function to a shred and tag them. Once that’s done, evaluating code from within shred will still work since all the dependent code will be evaluated as well.
However, you can also use structs or even regular code blocks and link them up with tags. Here’s a quick demo: