proton

https://github.com/dvcrn/proton
2016-07-18T15:08:02.000003Z

@thheller: was thinking about the namespacing cljs.core issue again; is there any reason not to try and detect and reuse an existing cljs.core instance? supposing it has the right version

2016-07-18T15:08:50.000004Z

Was thinking of writing a cljs package and thought what if I end up with three cljs.cores loaded into memory!

thheller 2016-07-18T15:09:24.000005Z

@tgg the problem is that they must coordinate with each other

thheller 2016-07-18T15:09:44.000006Z

lib A loads goog/base.js

thheller 2016-07-18T15:09:58.000007Z

lib B also loads its goog/base.js

thheller 2016-07-18T15:10:10.000008Z

so if A did any modification to goog

thheller 2016-07-18T15:10:14.000009Z

B will override it

thheller 2016-07-18T15:11:00.000010Z

shadow-build will disable goog.provide for example, but proto-repl enables it again and tries to provide cljs.repl again which is an error in closure

thheller 2016-07-18T15:11:20.000011Z

cljs.core is not the problem

2016-07-18T15:11:39.000012Z

no sorry I realise that; I really meant all the cljs assets required for a reasonable runtime

2016-07-18T15:11:43.000013Z

but you're right

2016-07-18T15:12:36.000014Z

although; is there a cheap hash one can do to check for modifications? would that be a potential work around?

thheller 2016-07-18T15:12:42.000015Z

closure is sort of at odds with the whole node.js ecosystem

thheller 2016-07-18T15:12:50.000016Z

since closure expects to optimize the whole program

2016-07-18T15:12:56.000017Z

oh christ yeah

2016-07-18T15:13:14.000018Z

overlooked you saying closure there; just parsed it as clojure in my head

2016-07-18T15:13:31.000019Z

hrmmm

2016-07-18T15:14:04.000020Z

sorry; not much help at all with that!

thheller 2016-07-18T15:17:13.000021Z

to be quite honest

thheller 2016-07-18T15:17:50.000022Z

node.js packages written in cljs are far from ideal

2016-07-18T15:18:13.000023Z

think that's a byproduct of closure compiler?

thheller 2016-07-18T15:18:19.000024Z

no it isn't used

thheller 2016-07-18T15:18:45.000026Z

it is the way closure style code is organized

thheller 2016-07-18T15:18:57.000027Z

goog.provide and goog.require

thheller 2016-07-18T15:19:12.000028Z

is a completely different style from node require

2016-07-18T15:19:33.000029Z

it does feel as if there should be a more 'native' node.js approach to clojurescript

thheller 2016-07-18T15:20:22.000030Z

well ... 😛

thheller 2016-07-18T15:20:53.000031Z

the problem is that there is no "default" way to package things for node

thheller 2016-07-18T15:20:58.000032Z

it is all optimized for the browser

thheller 2016-07-18T15:21:10.000033Z

node has totally different concerns

thheller 2016-07-18T15:21:21.000034Z

and you really need to generate different code for the two

thheller 2016-07-18T15:21:57.000035Z

and the thing I did with shadow-build

thheller 2016-07-18T15:22:07.000036Z

doesn't really work unless everyone uses it

thheller 2016-07-18T15:22:38.000037Z

or sharing the cljs.core instances like you suggested

thheller 2016-07-18T15:22:43.000038Z

only works if everyone does

2016-07-18T15:22:50.000039Z

yeah 😐

2016-07-18T15:23:00.000040Z

if only atom had been written in cljs from the start!

thheller 2016-07-18T15:23:24.000041Z

yeah same story with React 😉

2016-07-18T15:23:49.000042Z

thanks for going over that @thheller, interesting stuff

2016-07-18T15:23:55.000043Z

lots to mull over

thheller 2016-07-18T15:25:24.000045Z

I'm not even sure how the node.js world deals with stuff like this

thheller 2016-07-18T15:25:38.000046Z

conflicting dependencies and such

2016-07-18T15:25:57.000047Z

well christ; we've all seen the dependency graphs that nodejs spits out

thheller 2016-07-18T15:26:01.000048Z

the thing is that you really WANT to share cljs.core instances

thheller 2016-07-18T15:26:53.000049Z

but how do you make sure both use the same version 😛

thheller 2016-07-18T15:27:15.000050Z

since libs are always lib+cljs.core

thheller 2016-07-18T15:27:24.000051Z

and cljs.core is not standalone

2016-07-18T15:27:38.000052Z

would be a great project ☝️

2016-07-18T15:27:40.000053Z

standalone cljs

thheller 2016-07-18T15:27:46.000054Z

not possible

2016-07-18T15:27:50.000055Z

it's fairly heavily wired into closure isn't it?

thheller 2016-07-18T15:28:09.000056Z

well maybe possible

thheller 2016-07-18T15:28:15.000058Z

but there is the whole macro side of things

thheller 2016-07-18T15:28:32.000059Z

it is built for whole program optimization aka closure compiler yes

thheller 2016-07-18T15:29:16.000060Z

funny enough there is work being done to compile ES6 type import or export stuff to closure

thheller 2016-07-18T15:29:20.000061Z

but not the other way arround

thheller 2016-07-18T15:29:30.000062Z

at least not that I have found

thheller 2016-07-18T15:29:41.000063Z

but I don't use node so I don't really care 🙂

2016-07-18T15:29:45.000064Z

😄

thheller 2016-07-18T15:30:05.000065Z

just annoying for hybrid stuff like atom/proton

2016-07-18T15:30:37.000066Z

Potential for a proton ecosystem to depend on a single/organised set of cljs.core instances though?

2016-07-18T15:30:56.000067Z

I certainly write now with a mind to proton > atom

thheller 2016-07-18T15:32:13.000068Z

well I can certainly imagine a packaging step that won't load cljs.core if it is loaded

thheller 2016-07-18T15:32:37.000069Z

but that again only works if everyone does it

thheller 2016-07-18T15:32:53.000070Z

and doesn't deal with the whole version thing

thheller 2016-07-18T15:33:24.000071Z

but it is just a packaging thing

thheller 2016-07-18T15:34:17.000072Z

for example if you run lein run -m build/release on proton

thheller 2016-07-18T15:34:52.000073Z

it creates a plugin.js that is just some setup code + goog/base.js + cljs/core.js etc concatenated together

thheller 2016-07-18T15:35:36.000074Z

ehm sorry not release the dev-repl one

thheller 2016-07-18T15:35:47.000075Z

release runs through the compiler

thheller 2016-07-18T15:36:12.000076Z

but you really don't need it since :simple doesn't do much and :advanced is pretty much impossible for node

2016-07-18T15:36:34.000077Z

makes sense

thheller 2016-07-18T15:36:58.000078Z

so if you instead of just concatenating things together

thheller 2016-07-18T15:37:23.000079Z

you wrap it in if (!thing.exists) { ..code.. }

thheller 2016-07-18T15:37:30.000080Z

there would be no conflicts

2016-07-18T15:38:12.000081Z

sounds feasible to me; might experiment

thheller 2016-07-18T15:38:27.000082Z

again only if everyone does it and you ignore versions

2016-07-18T15:38:32.000083Z

😄

thheller 2016-07-18T15:38:45.000084Z

since it completely bypasses what node and npm try to do

thheller 2016-07-18T15:39:56.000085Z

I hate node 😛

2016-07-18T15:40:13.000086Z

yeah; not a particularly big fan myself