core.logic

The facts and retractions functions do not take the relation's namespace into account when resolving the index.

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • 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)))

Activity

Hide
David Nolen added a comment -

fixed

Show
David Nolen added a comment - fixed
Hide
David Edgar Liebke added a comment -

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

Show
David Edgar Liebke added a comment - 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
Hide
David Nolen added a comment -

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

Show
David Nolen added a comment - Apologies for the slow response. Is this still a problem?

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: