BrannonBatson asked about making /**nocache**/ work for _run_tool. This page has some notes on how one might implement that.
Contents
Syntax
r = /**nocache**/ _run_tool(...);
For the sake of consistency, we should really make it possible to use on other kinds of cached functions
x = /**nocache**/ foo(/**nocache**/ bar());
How to implement this?
Need to capture the /**nocache**/ pragma and remember it in a member variable on the ApplyEC class.
In Parser.C we need to capture the /**nocache**/ pragma way up in the Expression() function and then pass it down through Expr1() ... Expr7() to get it to Expr8() where function applications are handled. Otherwise the "EatToken(TkIf)" up in Expression() will consume and discard a /**nocache**/ pragma.
When calling the primitive function in ApplyEC::Eval, we would need to pass an extra argument for the /**nocache**/ pragma state. This would have to be added to all primitive functions, changing the PrimExec function pointer typedef. (All but ApplyRunTool would ignore this new argument.)
ApplyRunTool would pass the nocache pragma state to RunToolFromCache(). RunToolFromCache() would then optionally avoid caching similar to ApplicationFromCache().
Similarly, ApplyFunction() would take an extra argument for the nocache pragma state and pass it to ApplicationFromCache() which would apply it similar to the handling of the noCache member variable of FuncEC.
Alternatives
ScottVenier suggests using a different method of putting a value inside the . binding that would disable caching for _run_tool. This would be similar to ./tool_dep_control, possibly ./tool_cache_disable. This would be easier to implement than what's suggested above.
KenSchalk argued against this for a couple reasons:
It's inconsistent, giving users two different ways to specify essentially the same thing. Using /**nocache**/ would be more consistent and less confusing for users.
If it was set early in a build, it could be passed down into many functions affecting many tools. This could be done inadvertently, disabling a lot of caching and making building less efficient. Using /**nocache**/ as described above would be sure to affect only the specified _run_tool call.
Another possibility would be adding another optional argument to _run_tool to disable caching. That would again be inconsistent/confusing, and _run_tool already has a lot of arguments.