Jul. 16th, 2013

tim: Tim with short hair, smiling, wearing a black jacket over a white T-shirt (Default)
I started trying to make rustpkg use workcache, but ran into a problem. So, workcache is a library for caching the results of functions. This is obviously a useful thing if you're trying to avoid recompiling outputs whose inputs haven't changed. To make this work, you pass the closure whose result you want to cache into a special wrapper function, called exec. Since if you really want to avoid re-doing work, you need to save the dependencies you've discovered persistently, exec also takes a "context" argument that includes a pointer to a database, among other things (which is just a file on disk). Also, exec takes a ~ closure, meaning that the closure's environment only has sendable things. You can think of sendable as meaning "no @-boxes", because @-boxed things are only task-local. But if the closure wants to invoke itself recursively, it needs to capture the workcache context inside it. And the workcache context isn't sendable; it contains @-boxes.

rustpkg discovers dependencies as it goes along, doing parsing, so you could start installing one package A, find another package B that needs to be installed, go ahead and install B, then go back to building A. So the natural way to rewrite this code using workcache involves passing around the workcache database to recursive calls. But that's not allowed, since it's not sendable and since the workcache wrapper requires a sendable closure.

Graydon agreed it would be better to rewrite the workcache code so that the context is sendable, so now I'm blocked on him doing that.

In the meantime, though, I also figured out the duplicate package problem from yesterday. It was really silly; I was adding in both the .rust subdirectory of the home directory and of the current working directory -- and all ancestors of the CWD. But what if the home directory is an ancestor of the current working directory (as one would normally expect it to be)? sadtrombone.wav

And in the meantime, finishing extern mod is blocked on fixing the duplicate-package bug, which is easier now that I've found it.

Profile

tim: Tim with short hair, smiling, wearing a black jacket over a white T-shirt (Default)
Tim Chevalier

November 2021

S M T W T F S
 123456
78 910111213
14151617181920
21222324252627
282930    

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags