cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
Oliver George 2019-11-20T08:43:22.369Z

I'm seeing some strange behaviour on the iOS simulator but only with a "release" config. It seems that a vector doesn't satisfy coll?

Oliver George 2019-11-20T08:44:01.369800Z

I suspect some new fancy VM optimisation. Just wondering if it's a known issue.

Oliver George 2019-11-20T08:45:39.370100Z

(not related to the new cljs release)

Oliver George 2019-11-20T08:49:47.371600Z

Here's some sample code and logged output. Note that vs is a vector, (coll? vs) is false but (satisfies? ICollection vs) is true! https://gist.github.com/olivergeorge/f4251884d74f32bba2025ebc48b626ef

mfikes 2019-11-20T12:34:31.372600Z

@olivergeorge If you have a repro, probably worth putting in a JIRA; that’s not a known issue to the best of my knowledge

Oliver George 2019-11-21T11:22:13.386800Z

Looks like I can blame a third party lib.

cfleming 2019-11-20T21:40:19.373600Z

Hi all, I’m interested in the code that does the new analysis on Google Closure namespaces. Could someone point me to where that lives in the compiler?

cfleming 2019-11-20T21:43:12.374200Z

@thheller Great, thank you!

Oliver George 2019-11-20T21:48:05.374400Z

Thanks Mike. I'll do my best to isolate a simple repro. Another possible cause would be the Metro bundler doing something to the CLJS output. We've already got one patch to disable a breaking optimisation.

thheller 2019-11-20T21:49:18.375800Z

a word of caution on all of that: CLJS is stuck on a rather old Closure Library version. Google has since done a lot of changes and started introducing several other variants of files besides goog.provide/`goog.require`. Those don't seem to work.

cfleming 2019-11-20T21:50:44.377100Z

Ok, thanks, that’s interesting. Currently Cursive uses Rhino to parse JS, and a while back that started giving problems on modern JS files, weird crashes etc. I have a branch from a while back starting to use the Closure parser but it got pushed aside by other things.

cfleming 2019-11-20T21:51:23.378200Z

At the time I found some files in Closure using their module system, which IIRC CLJS doesn’t support.

thheller 2019-11-20T21:52:10.379400Z

I updated shadow-cljs to use the latest closure library but CLJS is stuck on the old because of these yes

cfleming 2019-11-20T21:52:35.379900Z

I see, at the time I looked into it it seemed that that was pretty experimental, but they’re starting to use it more widely then?

cfleming 2019-11-20T21:52:47.380400Z

Do you have some analysis code in shadow I could look at?

thheller 2019-11-20T21:53:07.380700Z

yes, they started to migrate more and more

cfleming 2019-11-20T21:53:33.381300Z

Ok, interesting. I also need Cursive to have a better understanding of Node modules especially, which Closure seems to provide.

cfleming 2019-11-20T21:53:51.381700Z

The interface to the parser is pretty hard to work with, though.

thheller 2019-11-20T21:55:12.382300Z

I don't do much analysis of JS at all in shadow-cljs. this is pretty much the only thing that is used

thheller 2019-11-20T21:55:34.382800Z

just extracts require import or goog.require

thheller 2019-11-20T21:56:17.383Z

but that is used for all node_modules code as well

thheller 2019-11-20T21:56:36.383200Z

I don't have anything to extract type signatures or docstrings though

cfleming 2019-11-20T22:11:57.383500Z

Great, thanks, that’s very helpful.

cfleming 2019-11-20T22:14:13.383700Z

Yeah, that looks pretty similar to what I ended up with IIRC, I’ll go through it in detail later. Thanks for that, it takes a while to figure out how to use the compiler API.

thheller 2019-11-20T22:17:53.383900Z

yeah. getting the basic AST is relatively easy but getting to the docs and stuff gets complicated when you venture out of the old goog.provide namespace system