<< Back to previous view

[CLJS-642] deftype/defrecord should not emit goog.provides Created: 28/Oct/13  Updated: 04/Nov/13  Resolved: 04/Nov/13

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Julien Eluard Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None


 Description   

When compiling with optimizations :none a project referring to some external ClojureScript dependency (garden at least), executing goog.require("YOUR-ENTRY-POINT"); will throw an exception.

Find a project demoing the issue here.



 Comments   
Comment by David Nolen [ 28/Oct/13 6:17 PM ]

The problem here is that deftype/records emit goog.provides, Closure does not like multiple provides in a single source file - this problem crops up when not using file concatenating Closure optimizations - resolution of a namespace will be broken.

We need to remove the goog.provides around deftype/record and instead we should support something like (:import [goog.string StringBuffer]), will do something special, it will emit a goog.require("goog.string.StringBuffer") and it will alias StringBuffer to goog.string.StringBuffer.

Comment by David Nolen [ 28/Oct/13 9:05 PM ]

Support for :import was added in CLJS-312, supporting deftype/defrecord :import is fundamentally broken and should be backed out, :import should only be for Google Closure and Google Closure style libraries written in JavaScript.

Comment by Julien Eluard [ 29/Oct/13 8:03 AM ]

Would the following be the right syntax to use types defined by deftype:

(ns ...
  (:require [some.ns :as sns])

(extend-protocol IBlah

  sns/MyType
  ()
)
Comment by David Nolen [ 29/Oct/13 6:31 PM ]

Yes that's correct.

Comment by David Nolen [ 04/Nov/13 9:04 AM ]

fixed, http://github.com/clojure/clojurescript/commit/dbf31380b925815d832a6cc53364d063a59dafad

Generated at Thu Oct 23 01:17:30 CDT 2014 using JIRA 4.4#649-r158309.