cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
mfikes 2019-11-03T14:02:09.099900Z

With respect to a potential release: Canary is all at green. โœ… https://github.com/cljs-oss/canary

๐Ÿ’š 1
borkdude 2019-11-03T15:02:34.100500Z

@thheller @dnolen ๐Ÿ‘‹

dnolen 2019-11-03T15:03:07.101200Z

@thheller I agree that / should always work w/ an alias but that's not really different from today

thheller 2019-11-03T15:03:27.101900Z

(ns foo.bar
  (:require
    [goog.string.format]
    [goog.string :refer (format)]))

dnolen 2019-11-03T15:03:33.102200Z

(require [goog.date.UtcDateTime :as utc]) already works unless I missing something

thheller 2019-11-03T15:03:44.102600Z

this is one of the tricky cases

thheller 2019-11-03T15:04:01.103Z

you can't leave out the goog.string.format require since then format won't exist

thheller 2019-11-03T15:04:13.103500Z

but the only way to alias format is using the goog.string

dnolen 2019-11-03T15:04:43.104300Z

right I'm not sure I'm interested in that case just now

thheller 2019-11-03T15:04:46.104600Z

so the same case for classes

thheller 2019-11-03T15:05:21.105100Z

(ns foo.bar
  (:require
    [goog.foo.SomeClass]
    [goog.foo :refer (SomeClass)]))

thheller 2019-11-03T15:05:34.105700Z

if SomeClass is actually defined in the same file then no second require is needed

thheller 2019-11-03T15:05:42.106100Z

sometimes they are. sometimes they are not

dnolen 2019-11-03T15:05:43.106200Z

right but you don't know

thheller 2019-11-03T15:06:56.107300Z

so :refer (SomeClass) (SomeClass/staticFn ...) seems problematic to me

thheller 2019-11-03T15:07:58.108Z

also doesnt' work for any JS deps if we make it dependent on @constructor

thheller 2019-11-03T15:09:19.109Z

if we just make :as directly usable for anything but CLJS namespaces most edge cases become simpler

thheller 2019-11-03T15:10:16.109600Z

(and we already do for JS deps, just need to extend it to Closure namespaces)

thheller 2019-11-03T15:12:58.111800Z

but the argument against :as is the ambiguity. (:require [some.thing :as x]) x/foo and x.foo end up with the same code but are treated differently by the analyzer

thheller 2019-11-03T15:13:19.112100Z

but the . handling has many other issues already so probably doesn't matter much

dnolen 2019-11-03T15:20:43.112400Z

right but like I said it used to work this way

dnolen 2019-11-03T15:21:11.113100Z

there were a bunch of problems when you don't know whether something is or isn't a namespace

dnolen 2019-11-03T15:21:21.113400Z

to be honest we fixed this so long ago I don't remember all the cases anymore

thheller 2019-11-03T15:22:48.114300Z

I'm fine with (:import [some.thing Foo]) and (Foo/staticFn) but :refer (Foo) (Foo/staticFn) feels rather icky

dnolen 2019-11-03T15:23:16.114600Z

yeah

borkdude 2019-11-03T15:23:35.115200Z

and there is no ambiguity in the :import case, so that would be a no-brainer to re-implement?

dnolen 2019-11-03T15:23:45.115600Z

yes

borkdude 2019-11-03T15:26:16.115800Z

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

borkdude 2019-11-03T15:27:53.116200Z

I guess we could add that for a nnext release and ponder about the other :refer issue some more (or not)

dnolen 2019-11-03T15:34:51.116800Z

yeah

borkdude 2019-11-03T15:54:14.117300Z

why is this supported in CLJS (and diverging from Clojure), is there a real need for it?

(set! (js-obj "a" 1) -a 2)

borkdude 2019-11-03T15:59:07.117500Z

(https://clojure.atlassian.net/browse/CLJS-198)

borkdude 2019-11-03T16:00:00.118200Z

to be honest I've never seen it used in the wild, but probably because not a lot of people know this exists?

thheller 2019-11-03T16:04:12.118700Z

(set! thing -a 2) is nicer than (set! (.-a thing) 2) IMHO

borkdude 2019-11-03T16:05:06.118900Z

maybe Clojure should support it as well ๐Ÿ˜‰

thheller 2019-11-03T16:09:04.119100Z

set! is a weird beast ๐Ÿ˜›

dnolen 2019-11-03T16:11:58.119800Z

@borkdude I think maybe Fogus did that short-hand bit?

borkdude 2019-11-03T16:12:44.120Z

in JVM Clojure you mean? I don't know btw

dnolen 2019-11-03T16:13:46.120500Z

I mean the ClojureScript behavior

dnolen 2019-11-03T16:14:29.121Z

oh ha

dnolen 2019-11-03T16:14:31.121300Z

so old

dnolen 2019-11-03T16:14:33.121500Z

so I did that

dnolen 2019-11-03T16:15:02.122Z

yeah I did it so threading would work for all the mutable APIs

borkdude 2019-11-03T16:15:38.122200Z

it came up here: https://twitter.com/mfikes/status/1181708123511373827

borkdude 2019-11-03T16:32:59.123200Z

I've just fixed linting this set! variant in clj-kondo, but re-linting CLJS itself doesn't seem to have an effect on the amount of false positives. Maybe it's not used anywhere?

borkdude 2019-11-03T16:33:18.123500Z

(I'm not linting the test sources)

athomasoriginal 2019-11-03T17:29:29.125500Z

Would an issue like https://github.com/bhauman/figwheel-repl/issues/10 be something that the latest CLJS releaseโ€™s lib analysis tool would uncover?

dnolen 2019-11-03T18:40:51.126300Z

@tkjone on a plane so I can't the see link for some reason - but is the issue that Figwheel has a typo?

athomasoriginal 2019-11-03T18:41:54.127500Z

Yes. Figwheel is referencing glog/warn as opposed to glog/warning.

dnolen 2019-11-03T18:42:02.128Z

so yeah

dnolen 2019-11-03T18:42:11.128400Z

but the release does more of course

๐Ÿ‘ 1
athomasoriginal 2019-11-03T18:42:11.128500Z

What was interesting is that I only got the warn when using latest CLJS

dnolen 2019-11-03T18:42:38.129300Z

REPL support, var existence check, arity checking, return type propagation

๐Ÿ‘ 1
๐ŸŽ‰ 1
dnolen 2019-11-03T18:43:21.129900Z

and tooling could hook into - we record file / line / column info for each def

mfikes 2019-11-03T18:48:27.130500Z

I havenโ€™t sorted out the root cause, but unit tests failed on Windows: https://clojure.atlassian.net/browse/CLJS-3178

dnolen 2019-11-03T18:53:21.131Z

definitely a bit skeptical that 3137 could be the cause at the moment

mfikes 2019-11-03T19:01:50.132300Z

Yeahโ€”it seems it could be an unrelated sporadic failure.

mfikes 2019-11-03T20:51:58.132700Z

Yes, it was a sporadic failure---rebuilding it causes it to pass.

borkdude 2019-11-03T21:12:30.133300Z

weird that it can randomly fail. we have problems with advanced compilation on JVM11 + boot (although the errors there are not random)