precept

Preception!
carkh 2017-12-24T00:46:43.000023Z

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

carkh 2017-12-24T00:46:54.000035Z

that's why you put it along the rules

carkh 2017-12-24T00:47:20.000039Z

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

carkh 2017-12-24T00:47:55.000019Z

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

carkh 2017-12-24T00:49:51.000047Z

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

carkh 2017-12-24T00:49:56.000062Z

took the template

alex-dixon 2017-12-24T00:50:07.000027Z

Hm. Well you should be able to have multiple namespaces

carkh 2017-12-24T00:50:08.000056Z

then updated everything to current versions

carkh 2017-12-24T00:50:32.000042Z

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

carkh 2017-12-24T00:50:52.000078Z

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

alex-dixon 2017-12-24T00:51:15.000011Z

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

carkh 2017-12-24T00:51:40.000060Z

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

carkh 2017-12-24T00:52:09.000009Z

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

carkh 2017-12-24T00:52:23.000006Z

but doesn't properly qualify the symbols

carkh 2017-12-24T00:52:41.000054Z

so we're back at my original problem !

alex-dixon 2017-12-24T00:53:13.000008Z

Yarg. Ok

carkh 2017-12-24T00:53:31.000050Z

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

alex-dixon 2017-12-24T00:59:16.000043Z

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

alex-dixon 2017-12-24T00:59:38.000037Z

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

alex-dixon 2017-12-24T01:00:01.000114Z

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

alex-dixon 2017-12-24T01:01:16.000007Z

And that produces a session with rules from both namespaces

alex-dixon 2017-12-24T01:07:58.000067Z

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

carkh 2017-12-24T01:08:39.000027Z

https://github.com/cark/ptest

carkh 2017-12-24T01:08:46.000035Z

there is your minimal example

carkh 2017-12-24T01:09:08.000031Z

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

carkh 2017-12-24T01:10:00.000020Z

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

alex-dixon 2017-12-24T01:10:40.000020Z

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

alex-dixon 2017-12-24T01:11:35.000038Z

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

carkh 2017-12-24T01:12:15.000053Z

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

carkh 2017-12-24T01:12:33.000068Z

so when the session is expanding, the symbols are correct

alex-dixon 2017-12-24T01:12:47.000060Z

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

carkh 2017-12-24T01:13:03.000042Z

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]

carkh 2017-12-24T01:14:47.000095Z

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)

carkh 2017-12-24T01:15:27.000016Z

anyways i'll keep at it =)

carkh 2017-12-24T01:16:50.000019Z

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

carkh 2017-12-24T01:19:09.000018Z

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

alex-dixon 2017-12-24T01:33:24.000026Z

Np this is great feedback so thanks

alex-dixon 2017-12-24T01:35:44.000026Z

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

carkh 2017-12-24T01:36:05.000030Z

yes that works indeed

alex-dixon 2017-12-24T01:37:49.000038Z

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

alex-dixon 2017-12-24T01:38:21.000023Z

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

carkh 2017-12-24T01:38:44.000016Z

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

😕 1
carkh 2017-12-24T01:39:16.000029Z

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

carkh 2017-12-24T01:44:25.000029Z

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

carkh 2017-12-24T01:45:34.000008Z

that's like 9 days ago