@nephele –
(1) the github code shows “defaults to” comments under the XDG that show values that are basically for Linux rather than Haiku, possibly from an older state of Haiku? (I consider “mere comments” as being valuable parts of code/documentation!)
(2) I think of “cache” as “data you operate on and then discard” OR “data that has to be persisted and rapidly accessed”, but “state” as “data used by application” that may need to persist (e.g. such as across runs of a script) but which isn’t relevant to backup. The XDG documentation (e.g. XDG Base Directory Specification) also calls the XDG_CACHE_HOME as “non-essential” data–but per-machine I already know of scenarios [cache-like data] IS essential to keep, per the given setup/installation, but would not be if you re-install.
One example might be keeping connection information for networking (in mind just because of a habit of tinker-breaking networking things, particularly on the systemd-intrusion into all-things already-were-working on Linux without documenting any of it for us that they did so): scripts may need information about networking state from prior runs to make decisions, but that is relevant only to the given machine. If this data were in the location for “cache” then things that make decisions about what to discard/eliminate (e.g. cleanup) might just wipe it out and leave scripts without data to make decisions. There are multiple kinds of state worth considering, but it’s a kind of intermediate between persistent data (e.g. traditionally logged in /var) and cache (that really would traditionally go in /tmp), “log, but not that long, and then if you still need it, then add to log before you change it.”
(Worth noting: depending on what you’re doing it may also then break down to even finer-grained levels, but the per-machine cutoff is a useful threshhold and I can sub-dir , sub-identify, label-in-data-file, etc., to get that finer granularity rather than relying on XDG vars and filling-up memory at initialization of BASH and its vars.
I’m also contemplating (from the work of “helloSystem”) the reality of applications that move with removable devices…but not that much. In the era of having to secure things, mobile (not just phones but laptops), package managers, stores, walled gardens, and administered-by-IT, “portable apps” aren’t really that important/useful/etc. for most people.)
EDITED: changed "this is not correct, where per-machine the “state” above to “[cache-like data]”