indexInspecting data in dynamic programming languages
2022-11-03
When reading programs written in dynamically typed programming languages one does not have a type system that tells what properties a given variable has. There are several approaches for inspecting the values stored in a given variable while running the code for example by executing a unit test.
- pringing the values
- using a debugger
- saving the values as global variables. This is called "inline deffing" in Clojure. Down side of this is that you need to find names that do not collide with other variables or functions.
- vvvvalvalval/scope-capture: Project your Clojure(Script) REPL into the same context as your code when it ran ⬀ saves all variables in a given scope and then defines them in the namespace with the local names so that one can evaluate expressions inside a function while having the local scope available.
- one could use tracer such as:
- One could instrument the function so that it saves the parameters somewhere during a test run and then an IDE could provide tooling for inspecting values that a function parameter under the cursor had during the test run. IDE could also assist on writing code based on the structure of the date in the parameter.
Here is a list of relevant tools for Clojure: Clojure observability and debugging tools ⬀
This site is generated with zetgen