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

Rules are not redefined on hot load #80

Closed
kennyjwilli opened this issue Jun 9, 2017 · 5 comments
Closed

Rules are not redefined on hot load #80

kennyjwilli opened this issue Jun 9, 2017 · 5 comments
Projects
Milestone

Comments

@kennyjwilli
Copy link
Contributor

Currently in order to get rules to be redefined you must refresh your entire page. Development would be much easier if a "reloaded" workflow was supported.

I have just tested this with precept.rules/rules. It's probable that other macros are affected as well (defsub, define, etc.)

@levand
Copy link

levand commented Jun 9, 2017

If I can get #75 working, this should be easy (since you can just throw away the session and start working with a new one.)

@alex-dixon
Copy link
Contributor

Related: state can get blown away on figwheel refresh. #75 can provide options for the user to manage. In the meantime (or if we continue to store state at the implementation level) we might experiment with using defonce instead of def for atoms that are internal.

@alex-dixon alex-dixon added this to Backlog in Roadmap Jun 12, 2017
@alex-dixon
Copy link
Contributor

Brought this up in Clara #316 because it may be related to the issue there (deleting rules while developing requires figwheel to be restarted).

@alex-dixon
Copy link
Contributor

The following is CLJS specific:

It appears we've made significant progress. When we remove or rename a rule, it's removed from the session when figwheel reloads. This means we can comment out/rename/delete a rule, save the file, and see the resulting change in our browser without having to refresh the page. When we uncomment the same rule and save the file, we can see it has been added to the session. Again, no need to refresh the page, just save the file and figwheel will detect the change and reload.

At this point, I want to figure out what we want the global state behavior to be when adding or removing a rule. At present, facts in the session are wiped whenever a change to a rule is made. I imagine we'd like the state to remain, but for the resulting state to include the effects of any changes to the rules.

We'll need to make the following changes:

  1. Index one-to-many-facts
  2. Index all facts according to the way in which they were inserted (logically vs unconditionally)
  3. Read all facts from the index that were inserted unconditionally

The procedure for reloading should be able to be handled in a single function that sits below the session definition in the rule file. Not entirely confident about the order here but should be something like:

  1. Clear the env/compiler of all productions
  2. Insert unconditionally all facts taken from the index (unconditional inserts only).
  3. Clear the fact-index
  4. Fire rules

@alex-dixon alex-dixon moved this from Critical to In Progress in Roadmap Jul 13, 2017
@alex-dixon alex-dixon modified the milestone: 0.3.2-alpha Jul 17, 2017
@alex-dixon
Copy link
Contributor

PR #101

@alex-dixon alex-dixon moved this from In Progress to Done in Roadmap Jul 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants