proton

https://github.com/dvcrn/proton
2016-07-10T03:49:21.000073Z

Why is proton so slow to start?

2016-07-10T03:49:40.000074Z

it makes atom's startup slowwwwwwwwwwwwww

dvcrn 2016-07-10T05:01:05.000075Z

@robbyoconnor: it does?

dvcrn 2016-07-10T05:01:18.000078Z

just recently or always?

2016-07-10T05:06:41.000079Z

Has always been

2016-07-10T05:06:54.000080Z

I seem to only be comfortable in emacs

2016-07-10T11:25:29.000081Z

Hey @dvcrn, I’m running build/dev-repl but keep getting Uncaught Error: Namespace "cljs.repl" already declared. when an atom instance connects; is this something you’ve seen before?

2016-07-10T11:27:02.000082Z

Looks like it’s colliding with proto-repl?

dvcrn 2016-07-10T11:27:48.000083Z

yep correct it’s colliding

dvcrn 2016-07-10T11:27:54.000084Z

but proton should have been already updated

dvcrn 2016-07-10T11:28:00.000085Z

are you on latest master?

2016-07-10T11:29:06.000086Z

Yeah

2016-07-10T11:29:23.000087Z

What do you mean by already updated?

dvcrn 2016-07-10T11:30:36.000088Z

for that problem. the repl for proton should run under a different namespace

dvcrn 2016-07-10T11:30:37.000089Z

let me check

2016-07-10T11:31:04.000090Z

almost definitely something I’m doing; just can’t puzzle out what it is!

dvcrn 2016-07-10T11:32:13.000091Z

this commit should have fixed it - https://github.com/dvcrn/proton/commit/31fd64025b554dbe04cc18af4e67bc586ef9d151

2016-07-10T11:33:58.000094Z

Interesting; thanks for the pointer @dvcrn will keep digging through

2016-07-10T11:34:24.000095Z

Guessing proto-repl isn’t doing this ☝️ 😐

dvcrn 2016-07-10T11:37:08.000096Z

hrrm I’m getting the same error. Something must have changed in the previous commits

dvcrn 2016-07-10T11:37:16.000097Z

so it’s not your fault 😛

2016-07-10T11:40:59.000098Z

gonna try rolling back proto-repl; just to isolate off their latest change

dvcrn 2016-07-10T11:44:04.000099Z

ping @thheller as well. Any idea how we can get rid of Uncaught Error: Namespace "cljs.repl" already declared. once and for all?

2016-07-10T12:48:24.000100Z

@dvcrn am I right in thinking that error will prevent the freshly compiled js from being loaded?

thheller 2016-07-10T13:00:34.000102Z

@dvcrn @tgg the conflict should have been fixed for proton itself. If there are however multiple different cljs-based plugins being installed are bets are off

thheller 2016-07-10T13:00:43.000103Z

since they will conflict with each other but not proton

thheller 2016-07-10T13:00:58.000104Z

@tgg which plugins do you have installed?

2016-07-10T13:02:01.000105Z

Community Packages (52) /Users/timgreene/.atom/packages
├── Parinfer@1.15.0
├── advanced-open-file@0.16.3
├── atom-alignment@0.12.1
├── atom-beautify@0.29.9
├── atom-dark-fusion-syntax@1.1.0
├── atom-material-syntax@0.4.6
├── atom-material-ui@1.2.13
├── atomatigit@1.5.5
├── autocomplete-paths@1.0.2
├── autoupdate-packages@1.3.1
├── battery-status@0.11.0
├── blame
├── busy@0.5.0
├── comment-commander@0.2.0
├── easy-motion-redux@1.1.1
├── environment@1.2.0
├── ex-mode@0.10.0
├── expand-region@0.2.4
├── file-icons@1.7.16
├── git-history
├── git-plus@5.16.2
├── golden-ratio@0.3.0
├── highlight-line@0.11.1
├── highlight-selected@0.11.2
├── ink@0.4.4
├── language-diff@0.4.0
├── language-pixie@0.22.0
├── language-racket@0.4.0
├── language-scheme@1.4.0
├── language-terraform@0.7.4
├── last-cursor-position@0.9.0
├── lines@0.13.1
├── linter@1.11.14
├── linter-clojure@1.1.2
├── maximize-panes@0.2.0
├── merge-conflicts@1.4.4
├── move-panes@0.2.0
├── nucleus-dark-ui@0.9.0
├── project-plus@0.9.0
├── proto-repl@1.2.0
├── proton-mode@0.11.0
├── recent-files-fuzzy-finder@0.2.4
├── relative-numbers@0.5.1
├── release-notes@0.53.0
├── tab-switcher@1.5.3
├── theme-switch@0.4.0
├── time-status@1.1.2
├── todo-show@1.6.0
├── tomorrow-night-eighties-syntax@0.13.0
├── vim-mode-plus@0.46.0
├── vim-mode-plus-ex-mode@0.4.0
└── zentabs@0.8.7

└── (empty)

thheller 2016-07-10T13:02:27.000106Z

do you by any chance know which are written in cljs? 😛

2016-07-10T13:03:04.000107Z

time for bisecting my plugins!

2016-07-10T13:03:11.000108Z

unless it's in the package.json...

thheller 2016-07-10T13:05:30.000109Z

I know that proto-repl uses some cljs, now just need to find the second one 😛

2016-07-10T13:06:41.000110Z

ag .cljs -l | grep -oP "^.*?/" | uniq
file-icons/
Parinfer/
proto-repl/
release-notes/
vim-mode-plus/

2016-07-10T13:07:02.000111Z

not conclusive but... hmm

thheller 2016-07-10T13:07:38.000112Z

if you disable all but one the error should disappeear

thheller 2016-07-10T13:08:41.000113Z

although none of these probably have a legitimate reason to ship with cljs.repl

thheller 2016-07-10T13:08:48.000114Z

except for proto-repl maybe 😉

thheller 2016-07-10T13:09:03.000115Z

so it comes down to the packaging of these plugins

2016-07-10T13:10:19.000116Z

Goes away with disabling proto-repl

2016-07-10T13:10:33.000117Z

this was the stack trace btw:

Error: Namespace "cljs.repl" already declared.
    at Error (native)
    at Object.goog.provide (/Users/timgreene/.atom/packages/proto-repl/lib/proto_repl/goog/base.js:273:13)
    at file:///Users/timgreene/Dropbox/Workspaces/github.com/proton/plugin/lib/cljs-runtime/cljs/repl.js?r=0.4816631136265521:1:6

2016-07-10T13:10:50.000118Z

looks like it is a bad interaction between proto-repl + proton 😞

thheller 2016-07-10T13:11:48.000119Z

hmm none of the plugins you listed are written in cljs (except proto-repl)

thheller 2016-07-10T13:12:15.000120Z

hmm that should work then

thheller 2016-07-10T13:12:57.000121Z

file:///Users/timgreene/Dropbox/Workspaces/github.com/proton/plugin/lib/proton.js

2016-07-10T13:13:28.000122Z

?

thheller 2016-07-10T13:13:46.000124Z

can you gist that somewhere?

2016-07-10T13:13:51.000125Z

oh sure

thheller 2016-07-10T13:17:44.000127Z

hmm looks like it is supposed to

thheller 2016-07-10T13:19:03.000128Z

hmm let me fire up atom

thheller 2016-07-10T13:20:19.000129Z

clojure.lang.ExceptionInfo: NS:proton.core has duplicate require/use for clojure.string at line 1 proton/core.cljs

thheller 2016-07-10T13:20:31.000130Z

you don't get this error when launching dev-repl?

thheller 2016-07-10T13:21:20.000131Z

hmm wtf

thheller 2016-07-10T13:21:35.000132Z

nevermind 😛

2016-07-10T13:21:49.000133Z

🙃

2016-07-10T13:26:21.000134Z

It's not a major deal to disable proto-repl to develop proton really

thheller 2016-07-10T13:27:54.000135Z

hmm I figured it out

thheller 2016-07-10T13:28:00.000136Z

totally my mistake 😛

2016-07-10T13:28:14.000137Z

🎉

2016-07-10T13:28:18.000138Z

what was it?

thheller 2016-07-10T13:28:19.000139Z

technically the repl is broken as well

2016-07-10T13:28:40.000140Z

is it the unnamespaced goog in repl.cljs?

thheller 2016-07-10T13:28:51.000141Z

yes

thheller 2016-07-10T13:28:55.000142Z

and no 😛

thheller 2016-07-10T13:29:21.000143Z

the issue is that the main plugin.js file sets up global.PROTON to use are the environment

thheller 2016-07-10T13:29:55.000144Z

but the repl itself just uses global

2016-07-10T13:30:12.000145Z

yeaah makes sense

thheller 2016-07-10T13:30:21.000146Z

that is why the Uncaught ReferenceError: goog is not defined when loading the cljs/repl.js

2016-07-10T13:31:20.000147Z

how to work around it? do we need to modify the cljs.core assets?

thheller 2016-07-10T13:31:23.000148Z

it works in the proton.js since all files are in there and no extra files are loaded

thheller 2016-07-10T13:31:40.000149Z

thinking

thheller 2016-07-10T13:32:30.000150Z

probably need to do the same trick proton.js does

thheller 2016-07-10T13:32:57.000151Z

prepend each file with

thheller 2016-07-10T13:33:12.000152Z

var goog = global.PROTON.goog;

thheller 2016-07-10T13:33:36.000153Z

and then pull in names from global to local

thheller 2016-07-10T13:34:16.000154Z

as proton.js does

thheller 2016-07-10T13:34:20.000155Z

var cljs = goog.getObjectByName('cljs');
cljs.core = goog.getObjectByName('cljs.core');
cljs.core.async = goog.getObjectByName('cljs.core.async');

2016-07-10T13:36:48.000156Z

oh nice, you're the author of shadow-build?

thheller 2016-07-10T13:36:54.000157Z

yep

thheller 2016-07-10T13:37:00.000158Z

yeah that fixes things

2016-07-10T13:37:14.000159Z

nice!

thheller 2016-07-10T13:37:32.000160Z

just need to figure out how to make the REPL load process aware of it 😛

thheller 2016-07-10T13:47:04.000161Z

ok should be simple. will fix later, gotta go now.

2016-07-10T13:47:17.000162Z

sure thing! thanks for your help!

2016-07-10T14:00:42.000163Z

Just for posterity I added:

var goog = global.PROTON.goog;
var cljs = goog.getObjectByName('cljs');
var proton = goog.getObjectByName('proton');
to the top of proton/plugin/lib/cljs-runtime/cljs/core/repl.js as a workaround

2016-07-10T14:00:53.000164Z

in case that helps anyone else

thheller 2016-07-10T18:38:17.000165Z

@tgg @dvcrn try with [thheller/shadow-build "1.0.213"], I'm not entirely sure that is works for all cases

thheller 2016-07-10T18:38:46.000166Z

but I get no conflicts with proto-repl, see if it works for you

2016-07-10T21:44:12.000167Z

nice; lgtm!