Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick background thread reloader and scaffolding #2

Closed
wants to merge 2 commits into from
Closed

Quick background thread reloader and scaffolding #2

wants to merge 2 commits into from

Conversation

CmdrDats
Copy link
Contributor

I wrote a quick function to fire off a background thread when your app starts so that it would automatically reload your namespaces without any extra fuss - a call to (start-nstracker ["src" "test" "checkouts"]) and you're done.

The other part is a bit more interesting - I've built a (scaffold!) macro that you can wrap around most any piece of code - then when that code executes, it will remember it and keep running it with its local state on every reload. I'm finding it immensely useful for GUI development - I can wrap it around panel generation and code almost live after getting to a certain state in the app with it automatically reconstructing the tweaked UI with it's local state.

It's not perfect, but I figured maybe it's useful to others, so I decided to contribute it to this project since it makes sense in here :)

…passed function with changed namespaces after reloading
…serving the state at the time of the original execution
@CmdrDats
Copy link
Contributor Author

Another thing I wanted to mention - This is what I call on startup to hook the two concepts together:

(tracker/start-nstracker ["src" "checkouts"] 500 
    (fn [_] (info "Reloading") (run-scaffolds)))

I'd put that into the library too, but I can't really get a good grip on where it belongs - should ns-tracker.core :require scaffold, or the other way round? So I'm going to go with letting people hook it up themselves :)

@weavejester
Copy link
Owner

These look like very useful additions, but they're beyond the scope of the library. The ns-tracker library is just for tracking changes to namespaces, not for reloading them.

However, I'd encourage you to take these changes and create a new library that depends on ns-tracker.

@CmdrDats
Copy link
Contributor Author

Ok, cool - I'll pull them out into another library then :) Thanks for the feedback!

@CmdrDats CmdrDats closed this Aug 17, 2012
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.

2 participants