cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
dnolen 2020-05-03T15:19:59.225900Z

@dominicm the problem is that's only true for modern JS environments - if you think about back when this was done this was to prevent bad code gen - stuff that couldn't be loaded

dnolen 2020-05-03T15:20:31.226500Z

and this is still true when you target stranger or older environments

dominicm 2020-05-03T15:23:54.228200Z

@dnolen in that case this feels separate from es5 or not, and is to do with some other aspect of the environment. It's possible to have an es3 environment with a method named x.delete.

dominicm 2020-05-03T15:25:26.229Z

In any environment, if you use an interop form it should do exactly as I say. The language in/out doesn't matter.

dnolen 2020-05-03T15:28:29.229300Z

so delete is really a weird special case

dominicm 2020-05-03T15:31:35.229700Z

No. All reserved keywords can be used as x.reserved

dominicm 2020-05-03T15:31:57.230100Z

The spec is unambiguous on this

dnolen 2020-05-03T15:35:36.230500Z

I will say I do not remember this being true having hacked on JS since IE6

dnolen 2020-05-03T15:35:41.230700Z

foo.class etc.

dnolen 2020-05-03T15:36:11.231200Z

you're saying this is present in the ECMAScript spec from 2001?

dominicm 2020-05-03T15:37:13.231700Z

I will double check for you, but I think so

dominicm 2020-05-03T16:21:57.231800Z

@dnolen there is no ECMA-262 for 2001. There's 2011 and 1999 (and 2009 in the middle). Which did you mean?

dnolen 2020-05-03T16:25:47.232600Z

pretty sure the reserved words are reserved in a hard way - including properties

dnolen 2020-05-03T16:26:08.233100Z

however I agree it's 20 years later and it's pretty rare to run into a JS runtime now that has this problem

dominicm 2020-05-03T16:27:14.233500Z

Okay. You're right :) In 3rd edition it was an identifier. I should be more careful. So from ES5+ all reserved keywords are available as property names (which I will now verify too!)

dnolen 2020-05-03T16:27:57.234100Z

ok cool

dominicm 2020-05-03T16:28:02.234300Z

(11.2.1 "Property Accessors" in the 3ed uses "Identifier", which cannot be a reserved name)

dnolen 2020-05-03T16:28:26.234900Z

so ... I think your idea is still fine, I think we can make this work in the dot property emission part of the compiler

dnolen 2020-05-03T16:28:59.235600Z

I think you can just check to see if reserved, if so and the language setting is ok, skip munging

dominicm 2020-05-03T16:30:34.235900Z

The number of finals in the title of 5ed 2009 ECMA-262 is... concerning.

dominicm 2020-05-03T16:31:34.236Z

@dnolen yeah, we already have the es5-whitelist or something, I think any places that use that need changing.

dominicm 2020-05-03T16:31:49.236100Z

Unless I miunderstand the purpose of having the es5-allowed for "default"?

dominicm 2020-05-03T16:42:44.236300Z

Why doesn't the compiler emit x['class']()? Is that also newer syntax?

dominicm 2020-05-03T17:07:37.236400Z

https://clojure.atlassian.net/browse/CLJS-3247 created ticket & uploaded patch. No tests, but happy to write them. Will need a little guidance on how & placement.

dnolen 2020-05-03T17:11:21.236900Z

great thanks, I'll have to take a look later - looking into other regression tickets today

dominicm 2020-05-03T17:12:26.237Z

No rush :). Playing around with this ticket I noted that ((.-delete window)) seems to work... so if I can get externs inference to play nice with that I'll be golden. I can't update until figwheel-main is updated anyway.

juhoteperi 2020-05-03T18:09:16.239400Z

I noticed with Reagent node module processing test suite that 753 doesn't work with default language-out, but works with :es5. Any idea idea if this is something already known or expected? Problem is with $jscomp name, which I think is from Closure polyfills for Object methods used by object-assign. (In this case the es3 output is 8KB vs 3KB for es5 output due to polyfills.)

juhoteperi 2020-05-03T18:12:31.240Z

Or the name might be ok, but a file that initializes $jscomp object is missing.

dnolen 2020-05-03T18:13:02.240500Z

my understanding is that $jscomp appears if language out is wrong

juhoteperi 2020-05-03T18:13:43.241300Z

Closure has the name written like that: https://github.com/google/closure-compiler/blob/3aaf3475128e8f7e398a42b3400256aee4870bbe/src/com/google/javascript/jscomp/js/util/polyfill.js#L26 so doesn't seem like problem with munging

dnolen 2020-05-03T18:15:22.241800Z

@juhoteperi my understanding is that it's expected, certainly not new?

dnolen 2020-05-03T18:15:45.242500Z

when I tried to compile React earlier - I had to set language out

juhoteperi 2020-05-03T18:16:15.243100Z

This worked in 597

dnolen 2020-05-03T18:16:16.243200Z

when I say not new I mean this seems unrelated to ClojureScript releases

juhoteperi 2020-05-03T18:16:38.243800Z

Probably caused by Closure compiler update

dnolen 2020-05-03T18:16:41.244Z

yes

juhoteperi 2020-05-03T18:21:37.245100Z

I'll just set language-out to es5. Doesn't seem important enough to investigate why es3 doesn't work.

dnolen 2020-05-03T19:08:07.245500Z

@mfikes hrm does the compiler inline protocol fns or something?

dnolen 2020-05-03T19:08:34.245900Z

@mfikes I realizing this is probably why https://clojure.atlassian.net/browse/CLJS-3244#icft=CLJS-3244 is so strange

dnolen 2020-05-03T19:08:40.246200Z

all the line numbers are off

dnolen 2020-05-03T19:08:46.246500Z

and they appear in a file w/o any imports

dnolen 2020-05-03T19:09:03.247Z

this would only happen if something was being inlined from a different ns

mfikes 2020-05-03T19:10:35.247500Z

Might be related to the recent "protocol static dispatch inlining"... let me find that commit

mfikes 2020-05-03T19:11:34.247700Z

https://clojure.atlassian.net/browse/CLJS-3185

mfikes 2020-05-03T19:12:07.248200Z

^ this was really about just making it easier for runtimes to inline stuff, that's all

mfikes 2020-05-03T19:26:41.249Z

FWIW, I tried an experiment reverting CLJS-3185 and the problem persists (and the line numbers are still off), so maybe CLJS-3185 is unrelated.

dnolen 2020-05-03T19:28:12.249300Z

I wonder if this is because of the type hints

dnolen 2020-05-03T19:28:24.249600Z

though that also seems strnage

dnolen 2020-05-03T19:30:35.249800Z

ok yes

dnolen 2020-05-03T19:34:02.250100Z

@mfikes actually the line numbers are fine

dnolen 2020-05-03T19:34:28.250600Z

not used to all this type inference stuff working 😛

dnolen 2020-05-03T19:34:52.251200Z

anyways, somewhere we're trying to resolve type hints and that's going wrong - will look into that now

dnolen 2020-05-03T19:35:05.251600Z

@mfikes the inlining stuff definitely is completely unrelated sorry for the bother