CoNarrative / precept

A declarative programming framework
MIT License
657 stars 33 forks source link

`entities` macro breaks when subscriptions are moved to separate namespace #120

Open JBetz opened 5 years ago

JBetz commented 5 years ago

I tried creating a separate module for all my subscription definitions, and all of the subscriptions broke that were using the entities macro. The compiler spit out some undeclared variable warnings, but other than that, there was nothing useful for me to debug it. Replacing usages of entities with entity at least got rid of those warnings, but it took moving everything back into the same module for the usages entities to work again.

The subscriptions are nothing fancy either, so I have no idea what the issue was. Here's an example:

(defsub :notes
  [?eids <- (acc/by-fact-id :e) :from [:note/creation-date]]
  [(<- ?notes (entities ?eids))]
  =>
  {:notes ?notes})
alex-dixon commented 5 years ago

Really sorry about that! The entities macro was hard to implement. It does some weird stuff, namely splitting the rule it occurs in into two rules. That said there were some var resolution issues having to do with CLJS namespace resolution issues in Clara that were fixed as of 0.18.0 (I think). #111 and #112 talk about very similar issues if not the same you have. Looks like I may have fixed some of it in the latest master but the yet unmerged PR #116 that upgrades Clara to 0.18.0 may fix it fully.

I hope this helps until I can take a closer look.

JBetz commented 5 years ago

Okay, good to know. I'll just keep things in the same module for now.

Is there anything blocking #116, or does it just need QA?

alex-dixon commented 5 years ago

Just ran the todomvc example with it. More QA would be good (especially with rules split across namespaces). Nothing's blocking it other than nervousness on my part.