ClojureScript

Allow names from cljs.core to be properly resolved

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code

Description

It is not currently possible to redefine functions from cljs.core. For example, the following cljs:

(defn first [x]
1)

(first 2)

compiles to:

cljs.core.first = (function first{ return 1; });
cljs.core.first.call(null,2);

With the attached patch, it compiles to:

voronoi_diagram.rationals.first = (function first{ return 1; }
});
voronoi_diagram.rationals.first.call(null,2);

which is correct.

Activity

Hide
Chris Gray added a comment -

I have signed and sent the CA, though it was recently and might not be received yet.

Show
Chris Gray added a comment - I have signed and sent the CA, though it was recently and might not be received yet.
Hide
Chris Gray added a comment -

It was also necessary to remove some macros that are also defined as functions in cljs.core, since I need to redefine some of these functions in my project.

I have not checked that all the macros that I removed are implemented as functions, but at first glance they appear to be.

Show
Chris Gray added a comment - It was also necessary to remove some macros that are also defined as functions in cljs.core, since I need to redefine some of these functions in my project. I have not checked that all the macros that I removed are implemented as functions, but at first glance they appear to be.
Hide
David Nolen added a comment -

Thanks, but a patch to add compiler support for :refer-clojure :exclude is preferred. This would allow for the desired behavior w/o penalizing people who want fast arithmetic.

Show
David Nolen added a comment - Thanks, but a patch to add compiler support for :refer-clojure :exclude is preferred. This would allow for the desired behavior w/o penalizing people who want fast arithmetic.
Hide
David Nolen added a comment -

This actually already works, you just need to exclude the symbol you want to redefine

code
(ns foo.bar
(:refer-clojure :exclude [first]))
code

Show
David Nolen added a comment - This actually already works, you just need to exclude the symbol you want to redefine code (ns foo.bar (:refer-clojure :exclude [first])) code
Hide
David Nolen added a comment -

This actually already works, you just need to exclude the symbol you want to redefine

code
(ns foo.bar
(:refer-clojure :exclude [first]))
code

Show
David Nolen added a comment - This actually already works, you just need to exclude the symbol you want to redefine code (ns foo.bar (:refer-clojure :exclude [first])) code

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: