Today work has focused on the same two things as yesterday; These have been the ctest extension work and the Lean book. Progress has been made on the former, but the goal of finishing the path aggregate refactor has not been accomplished.
Work on the module resolution logic has gone fairly well, but as mentioned, it is not yet finished. I started off by implementing the function for searching for items whose path aggregate had some path matching some other item’s paths.
This also went through a refactor of the item look up logic in the item container. I realized that at this point we’d be best off coming up with an iterator of our own over all the items in a module.
This, of course, benefitted both the item lookup we use during resolution, and the above search for an item’s occurrences across the crate under different paths.
The idea for this latter function is fairly simple; We perform the same depth-first traversal of a given module tree, and accumulate a list of all items that yield a match while comparing path aggregates with the reference item.
The diffing between path aggregates is itself also straightforward; Provided two items whose sum of path aggregates is our universe, we compute the complement of one of them with an traversal.
The yield path aggregate can then be replaced for the path aggregates of both items. I decided to avoid going down the impure path because this way I can implement the strategy in the generic renaming interface explained yesterday.
Then I worked on the rest of the infrastructure required for syncing path aggregates across occurrences of an item in crate modules. I came up with a simpler solution than what I had thought yesterday, but it requires more work.
The idea is that, provided an item container with the items to be merged, and the whole-crate module tree, we can use each item as the reference for an individual whole-crate look up of item occurrences and update the tree.
This is the same as yesterday, except updating the tree is not quite as straightforward as it may initially seem. Once we’ve found and updated all path aggregate occurrences, we have to integrate those in the tree carefully.
If we integrate some item in a module that also happened to require integration, we have to integrate first the module, and then the item. Otherwise, we’ll destroy the item update in the whole-crate tree once we replace the module.
This would not have been that hard to sort out, but I decided to think a bit more. The above reasoning assumes that updates to the module tree require replacing entire items with a provided item.
I found it would be simpler to refactor the module tree update function to instead take a path, search for an item with such a path in the tree, and then execute a closure that is provided a generic view over the item.
That I believe to be mostly done, if not completely finished. The only thing that remains is to make use of it in the path aggregate synchronization function.
In terms of Lean work, there is not much to say today. I finished solving the end-of-chapter problems of the current chapter, and have also finished the next chapter. It wasn’t too amusing this time around; The chapter was on I/O.
It’s surprising how Lean literally has multiple DSLs embedded within it. Their do-notation is quite literally an imperative programming language embedded in a block that exists within a pure functional programming language.
I did quick work of the I/O chapter, and finally moved on to a chapter on proofs. I have finished reading through the text, but ran out of time today to start the end of chapter problems. I really am aching for those.
One thing I realized while reading about proof tactics already shipped with Lean is that they are a bit too eager. I would have expected to require proving definitional equality of terms without help from the runtime.
But there’s a bunch of tactics, including the proof on reflexivity, that will evaluate the expressions contained in the proposition when attempting to prove equality. Maybe there’s some way of tunning it down so I can do more myself.
None.
The ctest extension work will continue on Monday. This weekend we’ll be running our first official maintenance of the intercepting proxy server, working through the Lean book some more, and possibly working a bit on my Neovim configuration.