Fork me on GitHub
#clojurescript
<
2017-06-02
>
joelsanchez00:06:55

yes you can, so if you want to be cool and avoid the intermediate string, do this

joelsanchez00:06:57

cljs.user=> (binding [cljs.core/print-fn js/console.log] (cljs.pprint/pprint {:a 1})) {:a 1} nil

joelsanchez00:06:20

(console.log is an example, also beware of the asterisks...)

rads01:06:13

@joelsanchez: if you do (enable-console-print!) it will also do the same thing as your example above

ssaul04:06:16

#om Some om help would be greatly appreciated. I just cloned the repo and am trying to run through an example. I have navigate to /om/examples/hello just tried to run the following: lein cljsbuild once hello And I get the following errors. clojure.lang.ExceptionInfo: failed compiling file:examples/hello/out/cljs/pprint.cljs {:file #object[java.io.File 0x7dae9ff4 "examples/hello/out/cljs/pprint.cljs"]} ... Caused by: clojure.lang.ExceptionInfo: Invalid :refer, macro cljs.pprint/deftype does not exist in file examples/hello/out/cljs/pprint.cljs {:tag :cljs/analysis-error} ... Does anyone know how to get pprint working?

thheller05:06:01

@ssaul I don’t know the exact issue but you should run the lein from the project root, not the /om/examples/hello folder

thheller05:06:26

not sure if that is the issue though

lsnape07:06:55

I’m looking for some examples of how to organise and load cljs that’s compiled using closure modules, as described in David Nolen’s 2015 post: http://swannodette.github.io/2015/02/23/hello-google-closure-modules/

thheller08:06:09

@lsnape what do you want to know? the :modules support in core still has some issues but I can fill in the details if you have particular questions?

lsnape08:06:07

@thheller I’m really after some guidelines on how to lazily load the javascript from within the clojurescript. i.e. how I bake that logic into my existing code.

lsnape08:06:31

As the user navigates around the site.

thheller08:06:16

I started writing some stuff about that but it is still a work in progress

thheller08:06:48

that’s how it would work in shadow-cljs … core doesn’t have the :module-loader stuff so you’d have to roll your own

thheller08:06:21

someone wrote a guide on how to roll your own

thheller08:06:29

trying to find it

lsnape08:06:14

Thanks! So yeah it’s the implementation of loader/load that I’m interested in really.

lsnape08:06:59

The guide I tried to find was hosted on http://rasterize.io, but the server is down and I can’t find a cached version anywhere 😞

thheller08:06:17

ah yeah I think thats why I can’t find the guide 😛

thheller08:06:30

@arohner wrote that IIRC

lsnape08:06:45

I’m surprised at the dearth of community resources around code splitting. Seems to me like the only sensible way of getting a large compiled JS file down to a reasonable size.

lsnape08:06:05

(for a sufficiently large production Clojurescript SPA)

thheller08:06:31

@lsnape yeah .. I have been doing it for 3+ years and I do think it is very useful

lsnape08:06:07

Good to know! And I take it you’ve had some success with it?

thheller08:06:08

Using it in production ever since yes

thheller08:06:18

although not the dynamic loading

thheller08:06:51

since its a traditional webpage and not a SPA I know which page needs which JS

thheller08:06:09

so I just load the :modules I need “manually”

thheller08:06:02

while this http://www.smartchecker.de/ only uses one because it doesn’t need to calc stuff

thheller08:06:20

found that using <link as="script" href="/assets/smartchecker/js/common.94FA12F00A1477825565E742BB62B0D8.js" rel="preload"> provided a much faster experience than using async loading

lsnape08:06:27

I see, that makes sense. Site loads very quickly for me :thumbsup:

thheller08:06:29

although only chrome supports that

thheller08:06:29

but SPA has different needs … :module-loader is an experiement for that

lsnape08:06:30

And I take it that rel="preload" is ignored in unsupported browsers.

thheller08:06:40

but I’m not using that in production yet

thheller08:06:48

yeah no effect in other browsers

thheller08:06:16

https://w3c.github.io/preload/ it may become a standard though

lsnape08:06:18

Well I’m keen to have a go at it myself. Google’s Lighthouse report flagged that the size of the js and stylesheets need to come down: https://writeandimprove.com/workbooks

lsnape08:06:51

There are a few other things we could do, but modules seems like the only way to go if we want to stay a SPA!

thheller08:06:38

nice site but yeah the chrome coverage thing shows that 70% of the code is unused when I just load the page

thheller08:06:17

:modules would solve that definitely

lsnape08:06:13

How did you find that metric?

thheller08:06:10

in the chrome devtools there is More Tools -> Coverage that opens a panel

thheller08:06:52

hit the reload/record button and click around a bit in the page

lsnape08:06:57

Ah it’s a Canary feature 🙂

lsnape08:06:22

Looks super useful, thanks!

thheller08:06:33

ah yeah I’m using chrome beta Version 59.0.3071.71

thheller08:06:47

super useful indeed

ejemba09:06:40

Hi, is that possible to access localStorage in clojurescript ?

pkova10:06:11

yup, for example (.. js/window -localStorage) or js/window.localStorage`

metametadata10:06:17

there's also a nice high-level wrapper around localStorage: https://funcool.github.io/hodgepodge/

niquola11:06:24

What is a simples way to try new fast cljs builds without forking clojurescript, i.e. some snapshot releases?

rauh11:06:12

@nicola If you just want to try: Copy the contents of cljs.compiler in a .cljc file in your project. It'll get picked up before the one in the cljs jar. But don't forget to remove it at some point! 🙂

rauh11:06:57

That's also usually the way I use when I hack on some libraries, easier than putting it in checkouts

joelsanchez12:06:02

How can I require all the namespaces of my application in cljs? It seems that explicit :requiring is needed (in contrast with CLJ)

joelsanchez12:06:44

(for example, multimethods: in clj they just work, in cljs I need to require every namespace that extends a multimethod)

joelsanchez12:06:57

This requires all namespaces that begin with "ventas.pages" (they extend a multimethod elsewhere)

ssaul12:06:17

@theheller. I tried that original and I think I got some others error. When I get on my computer I will try it and post that error. Thanks.

thheller12:06:12

@joelsanchez by far the best and easiest way is to just write it down manually

joelsanchez12:06:02

@thheller That's what I'm doing now, was just wondering

thheller12:06:25

:require in CLJS must be static so any macro is asking for trouble imho

joelsanchez12:06:29

I was thinking that maybe I could require those namespaces using the Google Closure api or something

joelsanchez12:06:35

But I'll stick with manual require for now

thheller12:06:36

FWIW I think build tools can help with that as well … but really the manual way is the most reliable and just works

ssaul13:06:45

@thheller I tried running from the root of the om project and I got the same error.

nathanmarz13:06:55

having problems extending cljs.core/IRecord:

(defprotocol Foo (foo [o]))
(extend-protocol Foo cljs.core/IRecord (foo [o] (println "hi")))
(defrecord R [])
(def r (->R))
(foo r) ;; throws exception

nathanmarz13:06:07

the equivalent in clojure with clojure.lang.IRecord works fine

nathanmarz13:06:13

is this a bug in cljs or intended behavior?

dnolen13:06:57

there are no interfaces in JavaScript to hook onto like that

dnolen13:06:23

in Clojure you can extend protocols to a Java interface

dnolen13:06:40

but there is no corresponding thing in JavaScript

nathanmarz14:06:05

so there's no way to get a protocol to apply to all records?

nathanmarz14:06:43

also, what's the purpose of cljs.core/IRecord?

metametadata14:06:10

extending the Object works (at least in Lumo): (extend-protocol Foo js/Object (foo [o] (println "hi")))

dnolen14:06:41

@nathanmarz you can add a default case and catch records there

nathanmarz14:06:15

good point, i'll do that

john14:06:14

@dnolen I'm pretty newb with the protocol stuff. Am I to understand that extending js/Object should be done with caution? Is that mostly because of the lack of Clojure namespacing on the JS side?

dnolen14:06:07

extending to js/Object is not a good idea, you will mutate the fundamental prototype

dnolen14:06:33

there’s special extensions for the JS primitive types to avoid that problem

dnolen14:06:45

(extend-type object ...) etc.

john14:06:17

Ah, rgr. Thanks. If I absolutely have to use js/Object though... what does it mean that I'm mutating the fundamental prototype? Am I potentially clobbering other possible foos on js/Object?

john14:06:45

or js/Object.prototype.foo

dnolen14:06:01

well I would say there’s probably isn’t a case where you ever have to mutate it

dnolen14:06:07

yes you will clobber Object for everyone

dnolen14:06:20

it will definitely lead to disaster under advanced compilation as your protocol extensions will get munged into a one or two characters

john14:06:18

ah right

chrisdavies16:06:45

Has anyone here used the :npm-deps feature alongside lein and figwheel?

borkdude16:06:15

@liesbeth @elisabeth you sound like you have Dutch names. Feel free to check out #clojure-nl

chrisdavies16:06:12

In response to myself... I searched the Slack channel for :npm-deps and found a comment that suggested I needed to do npm init. Tru dat.

omkar16:06:02

I have designed one HTML form with J's validation..Which redirected to next webpage My question is how do I print all data coming in form in next page

omkar16:06:51

Plz suggest

chrisdavies16:06:22

@omkar It's not clear to me exactly what you're asking for. Are you asking how to access the data from the previous page's form?

chrisdavies16:06:05

Gotcha. Did you submit the form to a server?

chrisdavies16:06:35

Generally, that's what you do. Submit form -> server -> server does a redirect -> server serves up the original data into the next page.

chrisdavies16:06:45

If you're using an SPA, things are different.

chrisdavies16:06:53

Are you writing an SPA?

omkar16:06:49

There is no server interaction .How do I do it??

rgdelato16:06:56

I think running npm init should only be necessary if you already have a parent directory with a package.json/`node_modules` (node will try to install to that parent directory)

omkar16:06:54

Is it necessary ??Can't I do it simpley using HTML CSS JavaScript

chrisdavies16:06:42

@rgdelato Well, dang. I just checked and there was a node_modules directory sitting way up near the root. That should never have been there.

chrisdavies16:06:10

@omkar You can do it just with HTML, CSS, and JavaScript. I can think of two ways.

chrisdavies16:06:47

One is to not actually do a "form post" at all, but to capture the data and redraw the screen (e.g. using some client-side templating or React or whatever).

chrisdavies16:06:06

The other is to do a "GET" instead of a "POST', and to pull the form values out of the URL in the next screen.

chrisdavies16:06:17

@rgdelato Thanks, by the way!

omkar16:06:52

Can put please tell me how do I do it with server

chrisdavies16:06:24

Hm. That's a very broad question.

chrisdavies16:06:42

Have you ever done a form post before with any server stack? (e.g. with Rails or PHP or whatever?)

chrisdavies16:06:29

What exactly are you trying to do? What is your application for?

omkar16:06:21

I have no clear idea. I am creating webpages one by one to learn things. Now I think to make it as project

omkar16:06:38

I used HTML CSS bootstrap JavaScript

rauh16:06:22

Silly question: Do you use Clojurescript? 🙂

chrisdavies16:06:41

^^^ I was just going to ask that. 🙂

omkar16:06:59

No I didn't

chrisdavies16:06:25

I think what you need to do is follow a basic intro to web-development tutorial.

chrisdavies16:06:37

What programming language are you most comfortable with (if any)?

chrisdavies16:06:23

You've done Angular 1 before? How did you handle forms in NG1?

chrisdavies16:06:09

Anyway, if Java is what you're most comfy with, I think I'd start here: https://playframework.com/

chrisdavies16:06:34

See if you can find a good step-by-step tutorial on how to build applications using that framework (or another Java framework).

chrisdavies16:06:20

I'm not familiar with the Java world, but last I checked, that seemed to be the framework I'd likely use if I had to use Java.

chrisdavies16:06:49

I come from a C#, Node, Ruby background, and only know bits and pieces of Java because I like Clojure.

omkar16:06:01

What's closure

chrisdavies16:06:22

That's the language this Slack channel is concerned with.

omkar16:06:44

See, I want to learn HTTP interaction .I have created great webpage it has 5 inputs. Name age ...Etc Now on next page I want to print it from server

john16:06:45

@omkar you might want to try these examples: http://www.luminusweb.net/docs

john16:06:56

There are other more "SPA" oriented, all ClojureScript frameworks out there you can check out too when you're ready.

chrisdavies16:06:44

Right. I'd agree with John's advice if you're interested in learning Clojure. But it sounds like maybe you're not (and maybe you're in the wrong place for advice!) But what I'd recommend based on everything you've said is to start with a step-by-step tutorial on how to build a web application. You cn do it with luminus as John suggested or with Rails (they have excellent tutorials) or with Play (and that'd keep you in Java land, which it sounds like you're comfortable with).

john17:06:14

Yeah, I've heard good things about play.

john17:06:37

That Luminous example is complex, but it'll introduce you to a large number of pieces of a stack that you could actually find in production in the wild.

john17:06:43

For an SPA, re-com looks interesting for building forms: https://github.com/Day8/re-com

john17:06:33

For simple inputs though, in an SPA, I'd forgo any form HTML element altogether and simply listen for events on whatever kind of input element and then work with the values in the data that the element feeds into the event handler. Perhaps store it in an atom. Then when the next page renders, have it pull data from that atom.

omkar17:06:01

@rauh no question is silly in this world

adamvh17:06:42

untangled is dope for spa

mikerod18:06:53

I just realized that with schema lib, the schema.test/validate-schemas fixture doesn’t seem to be appropriate for cljs.test style fixtures (it takes the test fn to run). I’m not seeing any clear examples online of how to do it in cljs either

noisesmith18:06:34

@mikerod how is it not compatible? a fixture takes a test as a function then calls it

noisesmith18:06:54

you can use comp to use it inside your own fixture (or manually compose) if you need other fixture functionality

noisesmith18:06:17

oh wait - cljs.test - how is that different/

mikerod18:06:17

in cljs the fixtures don’t take the test function?

noisesmith18:06:37

I am now realizing I haven’t used fixtures in cljs…

mikerod18:06:38

(cljs.test/use-fixtures :once {:before (fn [] (println "Hello world!"))})

mikerod18:06:52

they are different due to its ability to also deal with async tests (I take it from the docs)

mikerod18:06:05

So with schema, I guess you could hack together something like

mikerod18:06:41

(cljs.test/use-fixtures :once 
{:before (fn [] (schema.core/with-fn-validation! true))
:after (fn [] (schema.core/with-fn-validation! false))})

mikerod18:06:02

However, I found it odd that the schema.test ns compiles on the cljs side to something not useful and with incorrect docs

mikerod18:06:17

I guess you could use it (haven’t tried), but not as a fixture

mikerod18:06:26

Would make for awkward tests though

mikerod18:06:45

Also, the approach I said above isn’t great since it is a global change and you aren’t sure it was “false” before the test

mikerod18:06:57

So probably would have to get the “original value” of that flag to reset back to in the :after

noisesmith18:06:34

it seems an odd design choice not to allow wrapping the test form in your own parent form

mikerod18:06:10

Yeah, I’m not a fan

noisesmith18:06:12

odd - this really looks like it would expect functions and not a hash-map

dev:kingfisher.core=> (clojure.repl/source t/use-fixtures)
(defmacro use-fixtures [type & fns]
  (condp = type
    :once
    `(def ~'cljs-test-once-fixtures
       [~@fns])
    :each
    `(def ~'cljs-test-each-fixtures
       [~@fns])
    :else
    (throw
      (#?(:clj Exception. :cljs js/Error.) "First argument to cljs.test/use-fixtures must be :once or :each"))))

mikerod18:06:13

I liked clj fixtures

mikerod18:06:17

for the most part

mikerod18:06:40

yeah, I was mostly going on the docs

mikerod18:06:50

I read the source some, but got a bit lost down deep in those macros

emil0r18:06:53

The Google Closure Library is just weird sometimes in their design choices. The InputDatePicker doesn’t update the widget when the widget is open and you type in a correct date that is different from the one chosen by the widget

mikerod18:06:56

(due to not enough time spent)

emil0r18:06:36

And setting it via events closes the widget

emil0r18:06:56

:thinking_face:

noisesmith18:06:45

quoting:

Instead of a map, a fixture can be specified like this:
   (defn my-fixture [f]
      Perform setup, establish bindings, whatever.
     (f)  Then call the function we were passed.
      Tear-down / clean-up code here.
    )

noisesmith18:06:06

so it supports the clojure.test style - or so it claims at least

noisesmith18:06:33

it just can’t do that with async - which is too bad

mikerod18:06:54

Oh interesting. I'll have to try. The main cljs site should mention that too. But if it works good.

mikerod18:06:07

Yeah async is more complicated though

chrisdavies19:06:19

@adamvh Interesting. I haven't checked out Untangled. Have you looked at re-frame? Looks like untangled uses om-next which seemed more complicated than re-frame when I (briefly) looked at it.

adamvh19:06:45

i have not looked at anything besides om-next

qqq19:06:15

I'd recommend just using reagent until the local state gets too complicated.

qqq19:06:28

at that point, it'll be clear what additional state managemnt tools you want

qqq19:06:47

tried to learn re-frame, om-next, untangled, and found them all "too structured" for my needs

adamvh19:06:30

i don't know javascript or really much about the browser at all, so opinionated monoliths like untangled are more up my alley

chrisdavies19:06:11

I like re-frame from what I've seen. I've done some pretty complex front-end apps (in Angular, Vue, and most recently in React). I feel like just using reagent will quickly mean a messy app.

adamvh19:06:13

"it's a thing wrapper over react + js" is less of a selling point for someone who doesn't know javascript 😛

captainlexington19:06:26

re-frame is amazing, but I don't know what your client-server interaction requirements are

qqq19:06:03

@chrisdavies : the problem I ran into re-frame .... is that it's sorta db like, and at that point, I really want a full featured db, like datascript, rather than re-frame

adamvh19:06:21

om-next is really complicated, though. especially because the literature associated with it is sort of vague about what exactly it is and is for

adamvh19:06:07

it was really reading untangled stuff that that made it click for me

captainlexington19:06:52

@qqq You can use a full-featured DB as the datastore if you want. re-frame is about atomistic state changes, which you don't get out of Vanilla reagant

qqq19:06:44

@captainlexington : not to play devil's advocate; genuine question: at that point, why do I need re-frame ?

qqq19:06:53

why not just reagent + datascript ?

qqq19:06:59

then have all updates be in datascript transactions

captainlexington19:06:07

@qqq I haven't used DataScript - I am not sure of the scope of their transactions. What would it look like to put attach a DataScript transaction to, say, the on-click of a button?

qqq19:06:53

in plain reagent, when the button is presssed, some function, usually :on-click is triggered right?

qqq19:06:07

so then this function would call a function which executes a transaction vs datascript

captainlexington19:06:31

Well, that does seem pretty straightforward. You could be right! Without understanding DataScript I sort of worry about what the code starts to look like at scale - is there an obvious place to look when I wonder why an action is producing a certain result? How many points of failure are there when an extended interaction doesn't work as expected?

captainlexington19:06:16

re-frame locks you into only worrying about events and subscriptions

captainlexington19:06:50

You can lock yourself in with your own patterns for that, but then the question becomes why not re-frame, at least to me

captainlexington19:06:19

Although it looks like using DataScript as the store for a re-frame DB is not as trivial as I thought it would be, so perhaps I shouldn't be opining at all 😄

mikerod19:06:38

@captainlexington with regards to: > Although it looks like using DataScript as the store for a re-frame DB is not as trivial as I thought it would be, so perhaps I shouldn’t be opining at all https://github.com/Day8/re-frame/issues/137 is a hot topic that relates I believe From the last post there https://github.com/Day8/re-frame/issues/137#issuecomment-302089561 there is an example fork that, I believe, shows that it can use datascript (maybe) https://github.com/chpill/re-frankenstein/ It is proof-of-concept I think to try to solve the issue

mikerod19:06:34

Some of this was concerning local state vs global, but from what I gather, it can apply more broadly to just managing your state elsewhere (even if it is still single-app-state)

captainlexington19:06:38

@mikerod Yeah! These are all interesting. I also found https://github.com/mpdairy/posh , which implies there is at least something extra you need to do to marry DataScript to reagent

mikerod19:06:04

Oh yeah, still haven’t looked hard at that one

mikerod19:06:10

good reminder

captainlexington19:06:15

Marry them in a sustainable way, I mean - and the sustainable marriage between data and UI is what I ❤️ about re-frame

mikerod19:06:42

Yeah, I think re-frame is on a good track to keeping state managed coherently

mikerod19:06:56

I’ve done it manually with reagent and I have somewhat converged on similar ideas

captainlexington19:06:21

So really all the advice boils down to (if whoever we were giving this unsolicited advice to is still paying attention) is "probably don't use just reagent by itself"

mikerod19:06:03

I think if the state interactions are not too complex reagent can be an alright starting point, but as you scale out, you’ll probably start to feel the pain

mikerod19:06:18

and then learn of the 50 different libs and millions of blog posts out there about managing state

mikerod19:06:25

(my story basically 😛 )

noisesmith19:06:35

yeah, I think a bunch of us have been through this

mikerod19:06:48

From what I have experienced at least, I do think the transition from a reagent only app to re-frame could actually go somewhat smoothly

mikerod19:06:02

if you were already starting to have some sort of controls over your state you were manually managing

mikerod19:06:16

but I don’t have a concrete success story with this

adamvh19:06:25

there are tutorials and stuff about integrating datascript with om-next 🙂

captainlexington19:06:55

I was also initially attracted to Untangled, too, but haven't looked at it since it was pre-beta

mikerod19:06:08

Yeah, I’m not cutting down the om-next side at all. I just haven’t had much experience there.

captainlexington19:06:15

and I shared @adamvh 's confusion about what om-next was all about

captainlexington19:06:33

And I haven't had to work on a full stack app since ^_^

adamvh19:06:56

i sort of assumed it would be like qt

noisesmith19:06:04

going pretty far with reagent (and no helper libs) made me realize what the point of om-next was

adamvh19:06:25

but imo it's basically just the "C" from MVC

noisesmith19:06:27

“reagent: training wheels for om-next”

adamvh19:06:02

and you use other libraries to make your V

adamvh19:06:59

i was like where's the freakin date-picker widget in this thing? but then i realize that it's basically just a much smarter version of something like qt's signals and slots

adamvh19:06:08

bolted onto a thin wrapper over react components

mikerod20:06:58

Ok, I guess this is the first time I’ve attempted to use schema with cljs, but it doesn’t look like schema.core/defn works?

mikerod20:06:10

I see no indication that it wouldn’t, but also no examples where it is actually used out there

mikerod20:06:32

I get Uncaught TypeError: ufv___55787.get_cell is not a function

mikerod20:06:50

where ufv is a local generated by the macro that is a flag to know if validation is to be on/off at runtime

mikerod20:06:59

it looks like it is an atom in cljs

mikerod20:06:07

so ufv___55787.get_cell wouldn’t be valid

mikerod20:06:24

It actually looks like ufv (atom {:value false})

mikerod20:06:50

I feel like something must jsut be wrong. Pretty sure I’ve seen schema.core/defn work in cljs before

mikerod20:06:29

but can’t find a real example

john20:06:23

Isn't a single state atom also the recommended setup for large apps in Reagent?

john20:06:17

That big state ball, while immutable, can still be hairy to update. Specter comes in handy there.

mikerod20:06:54

It’d be an interesting applciation area of spector

mikerod20:06:00

I haven’t actually used that for it though

mikerod20:06:18

I do think that is still the recommendation most of the time for Reagent though

mikerod20:06:22

Just from reading around

john20:06:26

Isn't re-frame, with the subscriptions, pretty much providing a lensing mechanism over that state atom?

pawel.kapala20:06:26

Hi, does anyone have good tutorial or lein template covering Planck + Lein + Reframe + Emacs? I’m having problems configuring this… thanks in advance for any url or tip how to do that.

mikerod20:06:14

@john I saw it sort of as that

mfikes20:06:16

@pawel.kapala Planck + Lein is covered somewhat in http://planck-repl.org/dependencies.html Planck + Emacs is covered in http://planck-repl.org/ides.html Reframe—hmm, I know Om Next can do something with self-host https://anmonteiro.com/2016/08/om-next-and-bootstrapped-clojurescript/ but I haven't delved into that world. You want all four of those things to work together? You're crazy 😝

pawel.kapala20:06:35

@mfikes thanks! so far I’ve managed to use re-frame with devcards on custom template, but I’d love to use Planck, sounds like I need to write blog post when I manage to do that 🙂 And yeah, spacemacs rocks, it would be rather hard for me to use something else 😉

mfikes20:06:17

Is re-frame self-host compatible?

chrisdavies20:06:59

@pawel.kapala Yes, please to the blog post, if you get it working.

chrisdavies20:06:41

I know it's probably controversial, but I'm not a Java guy (C#, JavaScript, Ruby). I'd love to be able to do real Clojure without JVM.

captainlexington20:06:51

I don't think it's controversial not to like the JVM. I think usually ClojureScript and even Clojure for Mono (which has a real name that I don't remember) are pretty close to 'real' though

captainlexington20:06:19

Any flaws with using ClojureScript for non-FED projects are more to do with the shortcomings of JS than CLJS

jtth20:06:11

I’m just curious as I’m just getting my legs underneath me with reagent and re-frame, but what is the allure of rum over reagent?

jtth20:06:25

Corollary: Is the emphasis and support for pure ClojureScript just people’s annoyance with the JVM, or for some more systematic reason (like keeping everything pure JS, with interop between front- and back-end libraries)?

captainlexington20:06:35

I think the purpose of self-hosting ClojureScript is that it's easier to get people to try it that way (at least, that's why I value it)

captainlexington20:06:04

Like, self-hosting ClojureScript could run entirely in a broweser

captainlexington20:06:12

You could have an entire IDE for it as a browser extension

jtth20:06:56

Ah, interesting idea.

joelsanchez20:06:38

How's the situation for "native Clojure"? Last time I checked there was no good solution

jtth20:06:38

That’s all I know about, at least.

jtth20:06:05

Though why you’d want that over the JVM I don’t really know, outside of some insane performance edge cases.

captainlexington20:06:49

And even then, how could you really optimize for it?

captainlexington20:06:03

I guess some people just don't like the JVM as a production runtime

captainlexington20:06:36

I've heard things about security flaws and what have you

joelsanchez20:06:51

I like the JVM, but it would be good to have small binaries that start instantly

joelsanchez20:06:16

For example if I want to rewrite Openbox in Clojure, JVM is not an option

joelsanchez20:06:32

I can't use Clojure for everything, 'cause of that

joelsanchez20:06:30

clojure-scheme belongs to the category of "last updated 20 years ago"

joelsanchez20:06:38

Still good to know

thheller20:06:45

very clojure-ish

noisesmith20:06:56

pixie is great, but it’s not nearly as performant as jvm clojure

joelsanchez20:06:57

Know about pixie, author said this: "Some other developers have commit rights and have pushed it along a bit, but I think it's somewhat a language looking for usecase."

joelsanchez20:06:20

I translate that as "not going to maintain this"

noisesmith20:06:25

it takes about a second less to start up and the vm is built into the binary though

thheller20:06:26

ah yeah didn’t follow it much

thheller20:06:52

it sounded promising when I looked at it 😛

joelsanchez20:06:24

Guess I could use one of the unmaintained / outdated options if I wanted to, for example, rewrite Openbox

joelsanchez20:06:39

Configuring (and extending) my userspace with clojure would be awesome

noisesmith20:06:42

pixie is fun - it makes it easy to do interop with c libs (or at least easier than it is from jvm clojure) - but the effort/reward probably isn’t there for doing anything interesting

joelsanchez20:06:23

Will give it a try then, there's also ferret but it is also abandoned

joelsanchez20:06:44

But I don't like it a lot

mfikes20:06:12

@joelsanchez One thing you can do is use ClojureScript to drive native code.

noisesmith20:06:03

@joelsanchez wait, is it just me or is that a repo with no source code?

mfikes20:06:15

That, or even a binary of your own making. For example, I did that to make an iOS binary. https://github.com/mfikes/goby

joelsanchez20:06:26

Not just you...and I don't know how to compile ferret anyway...and the source code, I do not know where it is

john20:06:28

@joelsanchez If you can get CLJS working on gnome extensions, which apparently run js, then you could probably build a window manager with CLJS.

mfikes20:06:23

Planck is really just the ClojureScript runtime and a bunch of C, and the C can do anything, really.

noisesmith20:06:47

eyah, planck on linux already uses the gnome js engine right?

mfikes20:06:03

Planck on Linux uses JavaScriptCore

noisesmith20:06:15

oh, I must be misremembering

noisesmith20:06:31

I could have sworn I had to install a bunch of gnome-dev-js stuff to build it

mfikes20:06:05

Interesting. Here's the list of build-time deps: https://github.com/mfikes/planck/wiki/Building

john20:06:24

yeah, looks like GJS runs on JavaScriptCore

noisesmith20:06:49

aha! that clears it up then

john20:06:43

spidermonkey... But I think there is a newer GJS thing

joelsanchez20:06:06

Yes I saw that, still I do not know how to compile it

joelsanchez20:06:49

Author says: "The latest sources are available at,", and then points to the repo that has no code

joelsanchez20:06:22

I will try cljs with the methods mentioned here

darwin20:06:28

he is using emacs + org mode, that is pretty hard pre-requisite for new contributors 😞

darwin20:06:55

I wanted to help on it, but wasn’t able to learn emacs in 30mins, so I gave up 😉

darwin20:06:06

will try again

joelsanchez20:06:14

Try spacemacs if you haven't already

mfikes20:06:42

I wonder if you can use Craig's stuff as a starting point if you wanted to build a native executable with Node. https://clojurescript.org/guides/native-executables António obviously went farther with Lumo.

noisesmith20:06:46

oh - so the source code is all inside org mode babel? lol

john20:06:27

I was def wrong. GJS is still the latest thing and it's on SpiderMonkey

joelsanchez20:06:06

Obviously what follows now is developing an API for building desktop components, then link that to React, and then use reagent to control that

joelsanchez20:06:11

The natural conclusion

joelsanchez20:06:17

Can't believe it.

mfikes20:06:26

I might take the leap and actually build an app that way soon.

captainlexington20:06:01

It's not even an insane conclusion. Most desktop UI toolkits sucks.

captainlexington20:06:12

I hate JavaScript as a runtime but I love how it interacts with HTML

joelsanchez20:06:59

Damn it, the thing is for macOS

mfikes20:06:18

Yeah, it supported Linux for a while.

pandeiro21:06:00

Is there any visual tool to inspect Node.js memory usage?

darwin21:06:45

@pandeiro Chrome DevTools -> Memory tab

pandeiro21:06:49

@darwin is that with node-inspector?

darwin21:06:05

no, DevTools recently added native support for node.js

thheller21:06:20

need to run node --inspect though

darwin21:06:35

btw. on the screenshot in the article, there is no memory tab, but I can confirm that latest canary + node v8.0.0 has support for it and it will appear there

pandeiro21:06:56

Yeah I found the memory tab, no graph like jvisualvm but good enough to have an idea

mobileink21:06:02

web-based editors. i don't need a full structured (xml-ish) editor, just something that allows users to mark phrases for special treatment, e.g. various kinds of highlighting. anything like that available in a cljs lib?

mikeb21:06:36

For node js debugging, it's great to see the Chrome/V8 team is actively supporting it. Cool stuff from I/O conference here https://youtu.be/EdFDJANJJLs?t=26m17s

john22:06:54

Seems like their whole Google Apps Script system pretty much runs on node.

mikerod22:06:13

New weird issue. When I am trying to make a uberjar with leiningen that includes all compiled js (via cljsbuild) it works if I have something like :output-to "resources/public/js/app.js" but if I try to put this one directory lower :output-to "resources/public/js/out/app.js" It doesn’t include the app.js. It actually doesn’t include the resources/public/js/out dir at all.