<< Back to previous view

[LOGIC-37] The facts and retractions functions do not take the relation's namespace into account when resolving the index. Created: 03/May/12  Updated: 28/Jul/13  Resolved: 27/Sep/12

Status: Closed
Project: core.logic
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: David Edgar Liebke Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File 0001-Fixed-issue-resolving-the-clojure.core.logic.Rel-ind.patch    
Patch: Code

 Description   

Inserting facts into a relation that is defined in another namespace, specifically a namespace that has been required but not referred (I don't see the bug if I :use the other namespace).

I've tracked the problem down to this line:

https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic.clj#L1621

In the facts function, when the relation index gets resolved, the namespace is not taken into account,

index (var-get (resolve (index-sym (.name rel) arity o)))

as it is when resolving the relation set.

rel-set (var-get (ns-resolve rel-ns (set-sym (.name rel) arity)))

Using ns-resolve, with rel-ns, seems to fix the issue for me.

index (var-get (ns-resolve rel-ns (index-sym (.name rel) arity o)))



 Comments   
Comment by David Nolen [ 27/Sep/12 9:42 PM ]

Apologies for the slow response. Is this still a problem?

Comment by David Edgar Liebke [ 27/Sep/12 9:50 PM ]

Hi David,

Nope, the problem has been resolved, as I recall you applied the patch and cut a new release the same day I submitted the request; so thanks again for the quick fix!

David

Comment by David Nolen [ 27/Sep/12 9:52 PM ]

fixed

Generated at Sat Dec 20 07:43:09 CST 2014 using JIRA 4.4#649-r158309.