Nim incremental compilation cache does not rebuild after timestamp‑preserving source edits
0 reputation · 13 Nov 2020, 16:23 UTC
The goal is to guarantee that modifications to Nim source files are detected for incremental builds even when the file’s modification timestamp does not change.
Currently the nimcache mechanism relies on file timestamps to decide whether a cached object file is up‑to‑date; certain editors or version‑control commands can leave timestamps unchanged while the source content differs, causing the compiler to reuse stale object files.
It is unclear whether the compiler should supplement timestamp checks with content‑based hashes, listen to build‑system change notifications, or adopt another strategy, and how such changes would affect build performance and correctness.
Should the Nim compiler add a content hash check to timestamp validation for cache validity? Could a build‑system hook be used to signal changes without relying on timestamps? What are the trade‑offs between faster incremental builds and the risk of using stale code?