Fork me on GitHub
#cljs-dev
<
2020-05-03
>
dnolen15:05:59

@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

dnolen15:05:31

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

dominicm15:05:54

@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.

dominicm15:05:26

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

dnolen15:05:29

so delete is really a weird special case

dominicm15:05:35

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

dominicm15:05:57

The spec is unambiguous on this

dnolen15:05:36

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

dnolen15:05:41

foo.class etc.

dnolen15:05:11

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

dominicm15:05:13

I will double check for you, but I think so

dominicm16:05:57

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

dnolen16:05:47

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

dnolen16:05:08

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

dominicm16:05:14

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!)

dominicm16:05:02

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

dnolen16:05:26

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

dnolen16:05:59

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

dominicm16:05:34

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

dominicm16:05:34

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

dominicm16:05:49

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

dominicm16:05:44

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

dominicm17:05:37

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.

dnolen17:05:21

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

dominicm17:05:26

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.

juhoteperi18:05:16

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.)

juhoteperi18:05:31

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

dnolen18:05:02

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

dnolen18:05:22

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

dnolen18:05:45

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

juhoteperi18:05:15

This worked in 597

dnolen18:05:16

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

juhoteperi18:05:38

Probably caused by Closure compiler update

juhoteperi18:05:37

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

dnolen19:05:07

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

dnolen19:05:40

all the line numbers are off

dnolen19:05:46

and they appear in a file w/o any imports

dnolen19:05:03

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

mfikes19:05:35

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

mfikes19:05:07

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

mfikes19:05:41

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.

dnolen19:05:12

I wonder if this is because of the type hints

dnolen19:05:24

though that also seems strnage

dnolen19:05:02

@mfikes actually the line numbers are fine

dnolen19:05:28

not used to all this type inference stuff working 😛

dnolen19:05:52

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

dnolen19:05:05

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