Clojurians
#precept
<
2017-12-24
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

carkh00:12:43

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

carkh00:12:54

that's why you put it along the rules

carkh00:12:20

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

carkh00:12:55

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

carkh00:12:51

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

carkh00:12:56

took the template

alex-dixon00:12:07

Hm. Well you should be able to have multiple namespaces

carkh00:12:08

then updated everything to current versions

carkh00:12:32

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

carkh00:12:52

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

alex-dixon00:12:15

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

carkh00:12:40

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

carkh00:12:09

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

carkh00:12:23

but doesn't properly qualify the symbols

carkh00:12:41

so we're back at my original problem !

carkh00:12:31

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

alex-dixon00:12:16

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-dixon00:12:38

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

alex-dixon01:12:01

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

alex-dixon01:12:16

And that produces a session with rules from both namespaces

alex-dixon01:12:58

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

carkh01:12:46

there is your minimal example

carkh01:12:08

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

carkh01:12:00

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

alex-dixon01:12:40

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

alex-dixon01:12:35

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

carkh01:12:15

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

carkh01:12:33

so when the session is expanding, the symbols are correct

alex-dixon01:12:47

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

carkh01:12:03

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]

carkh01:12:47

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)

carkh01:12:27

anyways i'll keep at it =)

carkh01:12:50

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

carkh01:12:09

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-dixon01:12:24

Np this is great feedback so thanks

alex-dixon01:12:44

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

carkh01:12:05

yes that works indeed

alex-dixon01:12:49

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-dixon01:12:21

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

carkh01:12:44

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

carkh01:12:16

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

carkh01:12:25

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

carkh01:12:34

that's like 9 days ago