dirac 2017-03-09

@darwin: is there an easy way to steal the cljs-devtools pretty printer to use it in an actual webpage instead of just the console? or are you using console specific functionality? [I want to visualize my datascript db, and I'd prefer to steal your cljs-devtools pretty printer instead of writing my own]

@qqq I think daniel compton wanted to do something like this

cljs-devtools generates JSONML representation of the data structures

you would need to implement actual renderer

and that would require some work

the code in DevTools which is rendering it in the console is not easily portable IMO

alright; I'll roll my own in svg then, thanks for the info! @darwin

there is another project which renders data structures in page, but I forgot its name

yep, that’s the one

I will probably extract some devtools consolee code into a standalone “iframe” app, and provide something like firebug lite (https://getfirebug.com/firebuglite)

this will give up a console which could be embedded in any html app

but again, this is not on my priority list right now

If people kickstarted together 500k, would that be enough for you to build a 'barebones' emacs like ide? Where you provide some minimal core, and scripting in cljs, and people ahck on their own modules?

Considering all the companies using cljs, 500k is not too high a number.

I think this already exists, it is called LightTable 🙂

kickstarted on 300k or so 🙂

haven't they moved on to 'Eve' ?

and had to promise everyone everything 🙂

How much money would we (as cljs community) need to raise to get you to hack full time on cljs-ide ?

but I’m not that radical anymore, Cursive works pretty well for me now

before I made the switch to IntelliJ it was a PITA

I’m not an emacs user - not yet 🙂

Was unaware OSX 10.11 screwed over your two apps.

I was asking for a trouble, it was a hack from day-1 🙂

I don’t believe it is viable to run a kickstarter-like campaign for cljs-ide, the community is still too small

maybe in a few years

in a typical browser repl, it's connected to "webpage I'm debugging", and I can execute arbitrary js/cljs code against that page is it possible to have a "dirac-devtools-repl" where it's connected to "actual devtools", and I can execute arbitrary js/cljs code, and program dirac devtools at the repl?

suppose hypotehticaly, I got some rich people to support this (I have not asked them yet, and this is a moonshot), how much would it take to get you started?

hard to tell, if it was a really good idea, it can be as low as zero 🙂

I have my own ideas, so you would have to convince me that yours are dramatically better 🙂

it's in my selfish best interest that someone is paid to work full time on dirac-cljs-ide

the idea is the "make dirac ide a full blown ide scriptable in cljs"

frankly, I don’t need money at this point, I have pretty long runway from TotalFinder and some other work

that is why I could play with cljs for almost 2 years now

I think turning DevTools into a full-blown ide is really difficult task

it definitely has a “cool” factor, but how it will be dramatically better than what we already have?

I agree, I don't think it's a hobby project, I think it needs to be funded for people to ahck on it full time.

I've always had this fantansy of emacs - elisp + clojure

and dirac devtools seems the perfect platform to build this tool on

I wanted to experiment with that lighttable fork (which later turned into the plastic project), but I haven’t discovered anything significant

and then parinfer came out, and I decided to wait and never came back to the project again

but this allowed dirac to be created, I focused on something new 🙂

we need someone to do some research project or some discovery not necessarily in Clojure/Lisp/Emacs space, it could be any language/ide and when they prove the idea, we could jump on implementing it for Clojure ecosystem

I’m not going to jump into another project where there is no clear goal, at least not at this point

you're clearly put more thought into this than I have

what about "a cljs repl attached to diract devtools itself"? This would allow all users of dirac dev tools to start expertimenting with wirintg their own mini extensions

and it is open-source, so you can hack on it directly, why do you need a REPL?

interactive vs slow developmnet

also you would be doing interop all the time, because devtools is in javascript

it'd be nice, if, for the last feature request, I could just open a up a dirac dev tools repl and starting playing with it / hacking on it myself instead of having you be the only person able to implement it

REPL is not a magical enabler here, yes, it improves productivity and dev cycle, but it does not teach you internals of devtools and how to interface with them

any non-trivial “extension” would need some cooperation with existing code

perhaps this is just me, but interactivity / immedaite feedback / ease of exploration has definitely helped me learn APIs faster

btw. you can open internal devtools on Dirac DevTools window, and you get javascript console there, which is almost what you want

how do I open devtoosl on devtools?

a new window popped up

my key setting is wonked; how do I know if this is a "level2 repl" or a "level 1 repl" ?

dirac has green menu highlight

standard devtools blue-ish

it is like inception 🙂

is that a level 2 repl, or is that still a level 1 repl?

not sure what do you mean

http://imgur.com/a/KJG6e <-- is this repl connected to my webpage, or connectd to dirac dev tools?

in that popup you have just normal javascript console

it says Dirac.Implant, so I'm thinking level 2

and what? Dirac implant is just a piece of cljs code running inside devtools code

so I don't ahve dirac on dirac yet

it is possible but you would have to have dirac1 connected to another chrome instance

a web page(running inside chrome1) <- dirac1 (running inside chrome2) <- dirac2 (running inside chrome3)

normal scenario right now is: chrome1 (web page) <- dirac1 (running inside chrome1)

in other words dirac1 connects back to the same chrome it is running in (debugger protocol)

can you give me a screenshot of what your "dirac debugging dirac" looks like? so I know what to aim for?

that would be a lot of work to setup

but it is possible in theory, dirac does not have to connect back to the same chrome

you can tweak the chrome debugging port in dirac extension options

err, I thought the FAQ says it's just " CMD+OPT+I " -- are we talking the same thing?

cmd+opt+i does the same thing as clicking the dirac button

when clicking the dirac button a new window opens with dirac devtools app, which uses websockets to connect to some debugger protocol (server)

normally it is running on localhost on port 9222

and it happens to be the same chrome instance, because you launched it with that —remote-debugging-port=9222 parameter

baptiste-from-paris 2017-03-09T09:30:54.863430Z

@darwin I can’t understand what the checkouts profile is used for in the sample project

baptiste-from-paris 2017-03-09T09:31:14.866403Z

it’s failing when I try to do lein dev in the sample project

you should not use lein dev under normal circumstances

baptiste-from-paris 2017-03-09T09:44:43.982827Z

I am trying/struggling to install dirac based on the sample project with figwheel template

baptiste-from-paris 2017-03-09T09:44:57.984802Z

that’s why I was checking dev profile

the dirac-sample’s project.clj is quite complex because I also use it for some debugging / development / testing tasks

but you should focus only on profiles which are mentioned in the readme (e.g. lein demo and lein repl)

baptiste-from-paris 2017-03-09T09:55:19.078930Z

ok

baptiste-from-paris 2017-03-09T09:59:05.111944Z

Managed to make it work but with 2 repl...

baptiste-from-paris 2017-03-09T10:00:43.128299Z

figwheel with =>

{:id "dev"
                :source-paths ["src"]

                ;; the presence of a :figwheel configuration here
                ;; will cause figwheel to inject the figwheel client
                ;; into your build
                :figwheel {:on-jsload "dirac-figwheel.core/on-js-reload"
                           ;; :open-urls will pop open your application
                           ;; in the default browser once Figwheel has
                           ;; started and complied your application.
                           ;; Comment this out once it no longer serves you.
                           :open-urls [""]}

                :compiler {:main dirac-figwheel.core
                           :asset-path "js/compiled/out"
                           :output-to "resources/public/js/compiled/dirac_figwheel.js"
                           :output-dir "resources/public/js/compiled/out"
                           :source-map-timestamp true
                           ;; To console.log CLJS data-structures make sure you enable devtools in Chrome
                           ;; 
                           :preloads [devtools.preload dirac.runtime.preload]}}
and lein repl which I connect with cursive with
:repl {:repl-options {:port             8230
                                   :nrepl-middleware [dirac.nrepl/middleware]
                                   :init             (do
                                                       (require 'dirac.agent)
                                                       (dirac.agent/boot!))}}

Hello darwin 🙂 Sorry to report a bug (Dirac is so a very great tool!) bug since the last release methinks that Dirac devtools sometimes crashes when asked to evaluate something in console whilst it's paused the world at a debug breakpoint. When I say it crashes I means chrome extension crashes and chrome offer to reload it. Here is the tool stack I currently use: Dirac v1.2.0 | Chrome/59.0.3035.0 | Mac/10.12.3. If you confirm this bug and need more detailed data I can try to watch out next time.

osx needs to add a "dev mode" where it auto screen records your last 10 minutes; then you can save it at will as a 'bug report' 🙂

Well, I’ll wait a bit and if I can find enough to fill a proper bug report I’ll do so.

baptiste-from-paris 2017-03-09T13:30:49.934254Z

in the sample project, how do you launch figwheel ?

baptiste-from-paris 2017-03-09T14:36:11.756172Z

some of you have a project.clj template working with dirac/figwheel ; I am starting to be nuts trying to make it work

@baptiste-from-paris if you want me to help you in a meaningful way, please share your project as a git repo, so I can clone it and test it on my machine

snippets of project.clj are not easy to troubleshoot

baptiste-from-paris 2017-03-09T14:45:26.897041Z

ok ok. 5min

@piotr2b I’ve seen canaray stopping in debugger or exception “chrome is going to crash due to low memory” or something similar

it never crashed on me, I just continued

but it was annoying and I don’t know why is it happening

@darwin: this is a pure hypothetical; but if all the js parts of Chrome were written in cljs, pretty much everything we discussed would be much much much easier right?

iirc, on top of the v8 core, most of the chrome code is in js

and if it was in cljs, with an attached repl isntead, scripting devtools would be trivially easy

devtools is a non-trivial application, scripting it will require understanding it, no matter in which language it is written in

since you actually scripted devtools: if devtoosl was in cljs instead of js, how much of your development time of dirac would have been shaved off?

@qqq I don’t know this is really hard to tell. DevTools being written in js wasn’t a big obstacle.

I would guess DevTools has been developed over last 10+ years in team of 10+ people (started in webkit, then safari, then chrome). So you can imagine how much effort went into it.

of course, writing it from scratch would be faster, for people who know what they are doing

you can write a chrome extension which can hook into specific devtools places and provide some functionality there

unfortunately the extension points are quite limited, that is why I had to fork devtools, this extension api wasn’t powerful enough

oh man, by 'forking devtools + maintain patches" you literally mean you forked the devtools code and now have to maintain patches whenever devtools is updated

baptiste-from-paris 2017-03-09T15:10:16.300125Z

crazy lol

baptiste-from-paris 2017-03-09T15:10:26.303271Z

how much time did you spend ?

so hypothetically, if (1) you got hit by a bus, and (2) chrome auto updates a few times -- does dirac become broken / unuseable ?

baptiste-from-paris 2017-03-09T15:11:07.314355Z

lol 2nd time I see you write something like that @qqq

the first was om/next ?

baptiste-from-paris 2017-03-09T15:11:32.321258Z

yep

@baptiste-from-paris : it's a legit variatn of "what happens to Linux if Linus gets hit by a bus"

baptiste-from-paris 2017-03-09T15:12:16.334755Z

it’s killing our industry to be afraid of the bus

baptiste-from-paris 2017-03-09T15:12:40.341545Z

in my opinion 😉

btw. not sure if you noticed, but I maintain filtered chromium branch containing only devtools: https://github.com/binaryage/dirac/tree/devtools and here you have a diff between dirac’s version and oficial version: https://github.com/binaryage/dirac/tree/devtools-diff

the top commit in the devtools-diff branch shows you that rolling patch

it is not that scary afterall, I tried to minimize places where I needed to touch their code

somewhat related: you used to build stuff on firefox right? if the chrome devtools api is so bad that you had to fork it -- how is it still better than firefox api ?

I never used firefox api in a holistic way, always needed some hooks here and there, so I googled them and used them

and I was interacting with firebug most of the time (writing extensions to firebug, not firefox)

this is so absolutely insane

so dirac consists of (1) dirac/src/.cljs <-- actual dirac functionality and (2) a "rolling diff" vs chrome devtools <-- extra api end points that part [1] needs

no, it is not complete dirac code, because this is just the javascript part, I don’t include cljs sources in this diff

didn’t read your message correctly

specifically “implant” is the cljs code which gets injected into devtools javascript contex, other folders in dirac/src are not related to it: https://github.com/binaryage/dirac/tree/master/src/implant/dirac

there's really only one dirac feature I use: on assert false, let me walk up/down the stack frame and looko at local vars now, for the name unmangling part, it's some cljs stuff we don't care about for now however, to (1) hook into the V8 so we get called on exception and (2) get the entire stackframe as an object is this something I can do with plain devtools, or something I need dirac for?

technically, anything you can do with dirac, you can do with devtools alone (by re-implementing dirac code on your own)

I just stumbled across https://news.ycombinator.com/item?id=10400800 -- you started using CLJS in Jan 2015, and wrote Dirac in < 2 years ?

afaik, assert just throws, and devtools already know how to stop on exceptions, at that point you are able to inspect callstack

this is even possible from your normal javascript code, you don’t need devtools for it, are you familiar with js/Error.stack ?

I started hacking on Dirac in Dec 2015, first release in Jan 2016

no, clearly not, googlign now

so basically, anywhere in my cljs code, I can do a throw/catch + inspect https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Stack and get the entire stack frame at run time ?

you can write your own version of assert which will do that

it will throw and immediately catch, then you can inspect the callstack

unfortunately the callstack won’t be source-mapped, so you would have to do it yourself

this would be an advantage of doing something like this in devtools, because they have pretty complex machinery to do source-mapping

anyways, I still don’t understand what is your end goal

right now there's no end goal, it's just "learn how this works"

baptiste-from-paris 2017-03-09T15:32:38.676794Z

@darwin thanks a lot for your time that’s really cool !

devtools used to be this blackbox that I couldn't look into, and now it's a murky box I can sorta look into

baptiste-from-paris 2017-03-09T15:33:26.691012Z

I think I am a little short on nREPL; I’ve read lambda island tuto and clojure.tools.repl but it is still blur for me

1st problem, you have typo in js script file, so your javascript simply does not load

2nd problem you set wrong :agent :port in configuration

normally you should not mess with it,

will send you a diff

baptiste-from-paris 2017-03-09T15:41:41.829645Z

let me see

dirac middleware cannot work with piggieback middleware, you have to pick only one of them

if you want to use CIDER, you should do it as next step when you get basic dirac+figwheel setup working, you will need a separate nREPL server and connect to it with your CIDER

baptiste-from-paris 2017-03-09T15:47:45.936940Z

cursive for me 🙂

this is considered a super-advanced topic and I don’t use CIDER myself so I cannot help much here

ok, so you can have a look here (after you get the basic setup working): https://github.com/binaryage/dirac/blob/master/docs/integration.md

@baptiste-from-paris : I stopped using cider; the loss was barely noticable

for whatever reason, darwin decided to fork the entire cljs toolchain, but so far it appears to be worth the tradeoff

baptiste-from-paris 2017-03-09T15:49:35.967494Z

right the (dirac! :help)

baptiste-from-paris 2017-03-09T15:52:56.026447Z

1) Launch Chrome 2) lein repl 3) start script/dev-server.sh

baptiste-from-paris 2017-03-09T15:54:45.059536Z

got this

baptiste-from-paris 2017-03-09T15:54:52.061797Z

and I renamed index.html

did you apply my diff?

I still see that your page didn’t load your own javascript file

it is not on_remote.js but on-remote.js

baptiste-from-paris 2017-03-09T15:56:18.086990Z

I did, don’t get it

the compiled javascript contains dirac.runtime, without dirac runtime, dirac devtools is not able to talk to your page

oh, or you don’t get my changes in the diff?

slack is doing something “smart" here and does not allow me to post specific url:

baptiste-from-paris 2017-03-09T16:01:34.181886Z

@darwin do you see the automplete input field or not ?

baptiste-from-paris 2017-03-09T16:02:02.189986Z

ok

I see "Figwheel template Checkout your developer console."

the chrome has trouble parsing the compiled code, you tossed js-debugger in some wrong place

remove all js-debugger for now

baptiste-from-paris 2017-03-09T16:03:55.224359Z

ok

but that is not related to the dirac configuration issue

baptiste-from-paris 2017-03-09T16:04:13.229528Z

ok ok

dirac runtime was properly initialized in my case

baptiste-from-paris 2017-03-09T16:04:45.239090Z

what is you workflow ? launch chrome then the server then the repl then the dirac devtool ?

chrome must be running before you open dirac devtool 🙂

other than that I run them in arbitrary order

baptiste-from-paris 2017-03-09T16:06:07.264138Z

and figwheel for hot reloading ? how do you launch it ?

or use lein-cooper to wrap all this into a single command

baptiste-from-paris 2017-03-09T16:09:40.325717Z

ok figwheel load the form right

baptiste-from-paris 2017-03-09T16:09:50.328520Z

but not my server

you did not apply my diff correctly, I deleted your bogus :agent-port

or a browser cache is in play

or you need to clean whole project via lein clean

maybe the files were generated and lein didn’t reflect your changes

baptiste-from-paris 2017-03-09T16:13:28.395252Z

did all that but I am gonna remove chrome user-data-dir

you can try, but I doubt this would be the issue

I’m now referring that red message in dirac devtools console, it is simply trying to connect to a wrong port

the port should be 9222

9977 is there because originally you tried to override this setting via :agent-port config in your project.clj

baptiste-from-paris 2017-03-09T16:15:32.431436Z

ok

baptiste-from-paris 2017-03-09T16:22:14.550698Z

working but when I modify the name of my h1this is what I got :

baptiste-from-paris 2017-03-09T16:22:46.560400Z

but the rest is workign so THANKS A LOT 🙂 !

those are most likely issues with your figweel configuration or project configuration in general

I’m sorry, I’m here to help with dirac only

I think you are trying to do too many things at once

baptiste-from-paris 2017-03-09T16:24:00.581172Z

lol, that’s right ^^

I would recommend: first get familiar with cljs development with lein, second with figwheel, and when you feel comfortable add dirac into the mix 🙂

baptiste-from-paris 2017-03-09T16:24:29.589550Z

thank’s a lot for you time !

you might try #lein-figwheel channel as well

it looks like misconfiguration of compilation paths in your project

or your dev server is somehow misconfigured

baptiste-from-paris 2017-03-09T16:25:44.611631Z

yes I know, I am close !

baptiste-from-paris 2017-03-09T16:26:16.621377Z

I used a lot figwhhel with devtools but when I saw dirac yersterday it blew my mind !

😁 1
baptiste-from-paris 2017-03-09T18:52:51.085099Z

@darwin i did not realized that you were the maker of Total*

baptiste-from-paris 2017-03-09T18:52:58.086931Z

💪👏👏👏👏

baptiste-from-paris 2017-03-09T18:53:18.092630Z

How did you get into clojure ?

@baptiste-from-paris well, I used to be a web developer before I started some objective-c hacks

and when apple killed my business with System Integrity Protection, I played with some webdev and discovered cljs

and from there clojure

baptiste-from-paris 2017-03-09T19:58:39.149653Z

Where do you come from ?!

I’m rather rare example of a person going from js -> cljs, not from java -> clj and then cljs

baptiste-from-paris 2017-03-09T19:59:26.163612Z

I have to check this System Integrity Protection thing

I’m from Czech Rep.

what about you? what are you trying to build with clojure?

baptiste-from-paris 2017-03-09T20:00:24.180623Z

I am a freelance contractor in France, started clojure 6 months ago

baptiste-from-paris 2017-03-09T20:00:34.183452Z

Did only 1 contract here in clojure

baptiste-from-paris 2017-03-09T20:00:48.187551Z

The market is really small but I just love the langage

baptiste-from-paris 2017-03-09T20:01:22.197130Z

I am trying to reduce the cost of making "simple" native app with react-native + cljs

yeah, react-native is very promising

baptiste-from-paris 2017-03-09T20:02:22.214515Z

Yes impressive, coupled with om/cljs, it'a an awesome experience

baptiste-from-paris 2017-03-09T20:21:28.502843Z

when you’re using debugger, what info in devtool are you usually looking to ?

baptiste-from-paris 2017-03-09T20:21:35.504513Z

Scopes ? callstack ?

depends on situation

but most of the time I use just REPL and I don’t do classic-style debugging

mostly when exploring foreign code and need to break somewhere and explore surrounding state

baptiste-from-paris 2017-03-09T20:23:37.536182Z

ok; discovered some om.next internals with dirac

👍 2
baptiste-from-paris 2017-03-09T20:23:45.538248Z

really nice