ClojureScript

CLONE - Inconsistent munging of namespaces with dashes

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Approval:
    Screened

Description

When creating a file with a namespace like `foo.bar-baz` the compiled file will have a dash in the `goog.provide` but then use underscores within the code.

goog.provide('foo.bar-baz');
foo.bar_baz.something = ....

When requiring this namespace in another file the `goog.require` and the code both use dashes.

goog.require('foo.bar-baz');
var x = foo.bar-baz.something();

Assuming that file names must use underscores instead of dashes, as in Clojure on the JVM, there is a related issue in the `cljs.closure` namespace where it incorrectly creates file names from namespaces with dashes. The first line in the let form of the `get-compiled-cljs` function is the problem and can be replaced with a call to something like:

```clj
(defn ns->file-name [s]
(let [ns (name s)
path (string/replace (munge ns) \. java.io.File/separatorChar)]
(str path ".cljs")))
```

Imported from github issue #86

Activity

Hide
David Nolen added a comment -

clone was resolved

Show
David Nolen added a comment - clone was resolved

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: