cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
dominicm 2020-05-02T08:12:55.216500Z

@dnolen I'm still seeing delete be munged to delete$ with :language-out set to :es-next. It appears that :es5 first allowed delete to be used as a method.

dominicm 2020-05-02T08:17:18.216900Z

I'm not sure if this particular version should work, but it's one instance of the problem:

❯ clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.748"}}}' -m cljs.main -co '{:language-out :es5}' --repl
ClojureScript 1.10.748
cljs.user=> (str (fn [] (js/window.delete)))
"function (){\nreturn window.delete$();\n}"
cljs.user=> 

dominicm 2020-05-02T08:20:22.217Z

https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/analyzer.cljc#L198 given that I can get default to work, I suspect it's to do with this?

mfikes 2020-05-02T14:57:03.218200Z

Found a regression (not in 1.10.753, but in 1.10.741): https://clojure.atlassian.net/browse/CLJS-3244 (This is why Planck started failing in Canary, but it took me a while to track down as an upstream compiler issue.)

mfikes 2020-05-02T15:11:43.218400Z

^ Regressed with patch to https://clojure.atlassian.net/browse/CLJS-2957

dnolen 2020-05-02T15:53:21.218900Z

@dominicm can you say more simply what the bug is :es-next does not work, but :es6 and :es5 do?

dominicm 2020-05-02T15:54:46.219100Z

@dnolen Oops, I shouldn't have said ":es5 first allowed delete", I should have said "es5 first allowed...". None of the clojurescript languages support delete right now.

dnolen 2020-05-02T15:55:22.219500Z

@mfikes but still present in 753 yes?

mfikes 2020-05-02T15:55:30.219800Z

Yes

dnolen 2020-05-02T15:55:48.220200Z

@dominicm that's a bit odd since that's exactly what somebody tried the other day and it worked for them.

dnolen 2020-05-02T15:56:07.220600Z

@dominicm oh but that was default

dnolen 2020-05-02T15:56:35.221400Z

@dominicm this is trivial patch if you wanna submit one 🙂

dominicm 2020-05-02T15:56:36.221500Z

Yeah, default is explicitly whitelisted it seems. I think delete just needs adding to that list. I'm not sure if there's a list of the keywords that were added in es5

dominicm 2020-05-02T15:57:02.221600Z

Cool :) Will do, wanted to make sure it made sense first.

dnolen 2020-05-02T15:58:01.222400Z

@dominicm if you do that patch, it would be nice to just fix this up to include whatever reserved things became non-reserved

dominicm 2020-05-02T15:58:35.223Z

Yeah, looking for the spec now

dnolen 2020-05-02T15:58:35.223100Z

@dominicm tests would be nice, but if you don't do that I can easily add those to test the different compiler settings

dnolen 2020-05-02T15:59:09.223700Z

@mfikes thanks bumped to blocker though I think probably trivial - I suspect there's just a bad var in that file

dominicm 2020-05-02T16:02:16.223900Z

Oh god, my eyes: > For web browsers, there is an exception to this rule, namely when reserved words are used. Most browsers support identifiers that unescape to a reserved word, as long as at least one character is escaped using a Unicode escape sequence. For example, var var; wouldn’t work, but e.g. var v\u0061r; would

mfikes 2020-05-02T16:02:43.224200Z

I'm working on this minor self-host regression: https://clojure.atlassian.net/browse/CLJS-3245

mfikes 2020-05-02T16:07:55.224500Z

^ Hah, this one is being caught by CI

mfikes 2020-05-02T16:08:11.224700Z

Red Xs: https://github.com/mfikes/clojurescript/commits/master

dominicm 2020-05-02T16:19:25.224800Z

looking closer, as far a I can tell function delete(){ } is not supported, but let x = {}; x.delete = function() { return 10 } works. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors notes that properties must be an "IdentifierName", which means they can be any reserved keyword. That goes all the way back given the wording.

dominicm 2020-05-02T16:21:44.225Z

I think it's sensible to be generating functions without reserved keywords in but when emitting the syntax for things like js/window.xxx or react/xxx the name shouldn't be munged - it should generally be left alone.