This is similar to what Haskell has with trace[1]. It pretends to be a pure function (so it doesn't need the IO monad), but prints to stderr.
[1] https://hackage.haskell.org/package/base-4.21.0.0/docs/Debug...
[1] https://hackage.haskell.org/package/base-4.21.0.0/docs/Debug...
This is bc of non strict eval in Haskell, but still the core is that the lang is designed to not eval stuff when it’s not necessary.