ClojureScript

Can't (:use) protocol from another namespace

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

Description

The ClojureScript compiler doesn't correctly resolve the namespace of implemented protocol methods when the protocol is referenced via `(:use)`.

E.g.

(ns foo)

(defprotocol SomeProtocol
  (some-function [this]))
(ns bar
  (:use [foo :only (SomeProtocol)]))

(defrecord SomeRecord
  SomeProtocol
  (some-function [_] :quux))

The protocol function is compiled as though SomeProtocol was defined in the "bar" namespace, e.g.:

bar.SomeType.prototype.bar$SomeProtocol$ = true;
bar.SomeType.prototype.bar$SomeProtocol$some_function = function(this$) {
  var this__14211 = this;
  return"\ufdd0'quux"
};

This example works as expected in Clojure.

Activity

Hide
Brian Taylor added a comment -

If accepted, the patch associated with CLJS-271 resolves this issue.

Show
Brian Taylor added a comment - If accepted, the patch associated with CLJS-271 resolves this issue.

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: