Skip to content

feat(magic-unity): reload Clojure sources on save in the ClojureCLR editor - #173

Merged
skydread1 merged 1 commit into
flybot-sg:developfrom
parth-io:feat/editor-hot-reload
Sep 8, 2026
Merged

feat(magic-unity): reload Clojure sources on save in the ClojureCLR editor#173
skydread1 merged 1 commit into
flybot-sg:developfrom
parth-io:feat/editor-hot-reload

Conversation

@parth-io

@parth-io parth-io commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Closes #157

  • DebouncedFileWatcher debounces FileSystemWatcher events a single save emits for each path, after a 200 ms settle window.
  • ClojureReloader.Poll() checks for debounced paths via the caller's thread and evaluates the Clojure source code; a read that races the write is retried once after 150 ms.
  • Editor-only assembly Magic.Unity.Editor.Reload.asmdef, constrained to !MAGIC_RUNTIME_IN_EDITOR, so it compiles only in the Editor and when running ClojureCLR.
  • Exercised on Mono/macOS only. The 64 KB InternalBufferSize guards overflows on Windows, where there have been historical issues with dropped events. However, this is unverified on Windows.

@parth-io
parth-io requested a review from skydread1 September 7, 2026 03:47
Comment thread magic-unity/Editor/Reload/ClojureReloader.cs Outdated
Comment thread CHANGELOG.md Outdated
Comment thread docs/architecture.md Outdated
Comment thread magic-unity/README.md
Comment thread magic-unity/Editor/Reload/DebouncedFileWatcher.cs Outdated
Comment thread magic-unity/Editor/Reload/ClojureReloader.cs Outdated
Comment thread magic-unity/Editor/Reload/ClojureReloader.cs Outdated
Comment thread magic-unity/Editor/Reload/ClojureReloader.cs Outdated
Comment thread magic-unity/Editor/Reload/DebouncedFileWatcher.cs Outdated
@parth-io
parth-io force-pushed the feat/editor-hot-reload branch from 5007ad3 to 1cf9507 Compare September 7, 2026 09:58
…ditor (flybot-sg#157)

DebouncedFileWatcher debounces multiple events from FileSystemWatcher
upon one save. ClojureReloader polls this debounced event and retries
reads if there is any race condition with the write
@parth-io
parth-io force-pushed the feat/editor-hot-reload branch from 1cf9507 to 5cf5bc1 Compare September 8, 2026 00:02
@parth-io
parth-io requested a review from skydread1 September 8, 2026 00:02
@parth-io parth-io self-assigned this Sep 8, 2026
@skydread1
skydread1 merged commit 693c3c0 into flybot-sg:develop Sep 8, 2026
1 check passed
@parth-io
parth-io deleted the feat/editor-hot-reload branch September 8, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

There is no way to hot reload ClojureCLR code smoothly from source files when on the CLR runtime.

2 participants