defonce does not prevent overriding at all, but only when the file is reloaded. This is usually useful when var supports some state or context. I believe that using defonce here can be an artifact from the development of the library, where the developer needs to repeatedly reload the file during development, while maintaining the same value.
Since var does not point to ref, but the direct var using ^:dynamic is the right choice. Now the code can use set! or binding to change the value in the local stream.
bmillare
source share