Defrecord does not escape field names matching JS keywords (with/in/...)

Description

Defrecord produces code that's incompatible with ECMASCRIPT3 language:

Probably there should be some name escaping happening? I see that (defn with []) is compiled as cljs-test.core.with$. Should we do the same for records?

Environment

None

Activity

Show:
Nikita Prokopov
July 14, 2017, 6:37 PM

Is there any reason why CLJS defaults to language_in=ES3? Shouldn’t CLJS lock in the version of JS it outputs? As I understand, programmers have no control over how JS looks, but CLJS compiler has knowledge and control over what version of JS it outputs (and feeds into Closure)? In other words, why not set language_in to ES5 by default?

David Nolen
July 14, 2017, 6:20 PM

Related CLJS-871

David Nolen
July 14, 2017, 6:19 PM

The problem has less to do with records than how to handle reserved names. As far as I'm concerned the Closure warnings are sufficient, but if somebody wants to devise a warning patch that warns on using reserved fields names on deftpye/record when the output language is ES3, then be my guest.

Assignee

Unassigned

Reporter

Nikita Prokopov