The following function definitions each cause {{ERROR: JSC_DUPLICATEPARAM. Parse error. Duplicate parameter name ""}} at compile time with {{:advanced}} compilation:
`
(defn causes-duplicate-param [{_ :foo}]
(reify
Object
(a-function [-]
(fn [] "arbitrary function inside a-function body"))))
(defn causes-duplicate-param [{- :foo}]
(reify
Object
(a-function [_]
(fn [] "arbitrary function inside a-function body"))))
`
They generate, respectively:
`
duplicate_param_name_demo.core.t_duplicate_param_name_demo$core1601.prototype.a_function = ((function (map1599,map1599$1,_){
return (function (){
var self = this;
var = this;
return ((function (,map1599,map1599$1,){
return (function (){
return "arbitrary function inside a-function body";
});
;})(,map1599,map1599_$1,))
});})(map1599,map1599$1,_))
;
duplicate_param_name_demo.core.t_duplicate_param_name_demo$core1612.prototype.a_function = ((function (map1610,map1610$1,_){
return (function (){
var self = this;
var = this;
return ((function (,map1610,map1610$1,){
return (function (){
return "arbitrary function inside a-function body";
});
;})(,map1610,map1610_$1,))
});})(map1610,map1610$1,_))
;
`
(Notice the duplicate {{_}} param on the 5th line of each.)
The following do not:
`
(defn causes-duplicate-param [{- :foo}]
(reify
Object
(a-function [-]
(fn [] "arbitrary function inside a-function body"))))
(defn causes-duplicate-param [{_ :foo}]
(reify
Object
(a-function [_]
(fn [] "arbitrary function inside a-function body"))))
`
They generate:
`
duplicate_param_name_demo.core.t_duplicate_param_name_demo$core1601.prototype.a_function = ((function (map1599,map1599$1,_){
return (function (){
var self_ = this;
var $1 = this;
return ((function (_$1,map1599,map1599_$1,){
return (function (){
return "arbitrary function inside a-function body";
});
;})(_$1,map1599,map1599_$1,))
});})(map1599,map1599_$1,))
;
duplicate_param_name_demo.core.t_duplicate_param_name_demo$core1612.prototype.a_function = ((function (map1610,map1610$1,_){
return (function (){
var self_ = this;
var $1 = this;
return ((function (_$1,map1610,map1610_$1,){
return (function (){
return "arbitrary function inside a-function body";
});
;})(_$1,map1610,map1610_$1,))
});})(map1610,map1610_$1,))
;
`
(Notice that one of the {{_}} params has become {{___$1}}.)
My guess, though I haven't looked into the compiler code, is that the compiler escapes {{_}} to {{__$1}} when it would conflict with another {{}}, and also it translates {{-}} to {{_}}, but it doesn't notice the conflict when the ClojureScript symbols are different.