precept 2017-12-24

so I think i understand now, the session macro is pulling the code from all rules and expanding it in the namespace were it's used ...so if i put the session macro in precept.todomvc.session, i'll have trouble

that's why you put it along the rules

but then how do you do a large project, where you can't possibly have all rules in a single file

the fact that clara rules is so macro heavy is such an annoyance ><

i was in the process of making a small example with my troubles

took the template

Hm. Well you should be able to have multiple namespaces

then updated everything to current versions

then i tried moving the session macro call in its own namespace

just for the sake of it, because i encountered strange behaviours in my own project

(session ‘my-ns ‘other-ns ...)

but then i see that it complains about missing vars like precept.todomvc.session/insert!

that thing doesn't exist...it's actually picking it from the precept.todomvc.rules namespace

but doesn't properly qualify the symbols

so we're back at my original problem !

i just took the template and moved the session macro call from precept.todomvc.rules to a new precept.todomvc.session namespace

So i’m trying to reproduce, but I have a working example where rules can be defined in one namespace without a session definition

Then in another namespace with rules I have the session defined at the very bottom of the file

(session visualizer-session
         'precept-visualizer.rules 
         'precept-visualizer.other-rules
         :db-schema db-schema
         :client-schema client-schema
         :reload true)

And that produces a session with rules from both namespaces

I did have to require ’precept-visualizer.other rules at the top of the ns where the session is defined (in precept-visualizer.rules)

there is your minimal example

i'm quite the noobie with github, so it was a rather slow process =)

there is obviously something i didn't understand about it all

Well, this isn’t something I’ve tried before, so it might actually be a bug

If you’re just looking to get something working with multiple namespaces I know for sure that’s possible if the session is defined in a namespace that has rules in it

yes, that's because you're requiring the symbols required to make these rules work

so when the session is expanding, the symbols are correct

I’ll work on reproducing but if keeping the session in the same ns as some of your rules isn’t a problem and you’d like help with that I can assist with that

i know i can make it work by adding soemthing like this to the sesison namespace : [precept.util :refer [insert! insert-unconditional! retract! guid] :as util]

but the problem is getting worst when i start adding my own things ... for instance i have that log function i was importing in the rules namespace ....and of course it's also complaining about that ...which makes sense in a way..it was looking for precept.todomvc.session/log (translated to our exemple here)

anyways i'll keep at it =)

as it is right now, i need to know everything that's called from the session, and import it all, losing the namespace property of...namespacing... if you see what i mean

but hey with Christmas coming, don't feel pressured or anything =) there's no hurry on my side ! just wanted to let you know some troubles i ran into

Np this is great feedback so thanks

Had to take a call but will work on reproing. If you can keep the session def in a ns with rules you should be able to require other nses with just rules

yes that works indeed

Ok. I’ll file a bug if I can’t find a way to define a session in a separate ns with no rules

So far that seems the case so thanks for pointing it out

the underlying issue is that the session macro is not properly qualifying the symbols found in those rules

😕 1

there might be a way to walk the tree and do some magic there

hum you might be able to get rid of it by using the latest clara rules... that issue i linked earlier looks suspiciously close to our problem, and they closed it saying it was merged and all

that's like 9 days ago