This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-02
Channels
- # admin-announcements (1)
- # alda (1)
- # aws (4)
- # boot (276)
- # cljs-dev (3)
- # cljsjs (1)
- # cljsrn (3)
- # clojars (22)
- # clojure (174)
- # clojure-austin (1)
- # clojure-italy (2)
- # clojure-russia (20)
- # clojurecup (1)
- # clojurescript (233)
- # cursive (4)
- # datavis (97)
- # datomic (122)
- # hoplon (80)
- # ldnclj (8)
- # leiningen (6)
- # om (82)
- # reagent (10)
- # spacemacs (8)
- # specter (5)
Anyone else getting no packages listed when they visit http://cljsjs.github.io/ ?
Perhaps related to the Atlanta Linode DC / http://clojars.org outage?
Ahh I totally forgot that http://clojars.org was down for me earlier too
Anyone here familiar with boot-cljs-test
and know how I can get it to exclude specific files OR namespaces? I am wrapping up my pull request to add Electron support to lein-doo
and the final thing to get working are the boot
builds/tests (that are part of the circle-ci build).
Hrmm now that I typed it out, it hits me that I may be able to get boot-test-cljs
to run the tests in Electron. Either way, I've never really used boot before this so if anyone is experienced with boot-cljs-test
and can help, let me know.
@raymcdermott: no it’s “me”- I’ve been reading Clojure for the Brave and True and thought I should join this list.
@orther: help is on the way
@crisptrutski: thanks I took a little time earlier to actually look at boot-cljs-test and what it does. Read a few issue threads too. It seemed to me I should be able to get it working.
there’s a subtle issue with the fileset paths vs project paths for using karma, boot-cljs-test doesn’t actually support that yet
@orther: perhaps these links could help a little bit https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-15.md https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-16.md just take into account that clojars is down at the moment
not sure whether to solve that via changes to the boot test (latest boot can sync the target
directory mid pipeline easily) or with doo changes (remove hardcoding of (System/getProperty "user.dir”)
)
will experiment with both and submit PRs later this weekend
and http://cljsjs.github.io/ is listing packages again
not going to be around much today, but recommend #C053K90BR for getting any help
sent you https://github.com/orther/doo/pull/1 for the meantime
thanks @crisptrutski I really appreciate it
J’étais heureux de le faire 🙃
@orther: yes we should donate, but at the same time this is a problem of a DoS attack in atlanta
Yeah in one of Linode's updates, "It has become evident in the past two days that a bad actor is purchasing large amounts of botnet capacity in an attempt to significantly damage Linode’s business."
Hacked windows botnets? Or, dedicated private botnets? I guess AWS can be used as a botnet!!
Is it possible to prevent individual functions and npm modules from being smashed by advanced optimization programmatically? Purescript imports each javascript function with FFI. I think this approach might be better than using :externs.
@crocket :advanced
for node is probably not worth the effort, :simple
should be sufficient
Does anyone know of an example project I can look at that uses 'garden stylesheets'? All the examples I've seen are of in-line code. But I would like to see file/s that are stylesheet only, kind of like a .less file I imagine, but in hiccup, because that's how garden css looks...
There is also the lein -o
option for offline mode, but it doesn’t seem to be 100% all the time
@cjmurphy: I was using garden in one of my projects last year, not sure if this is a representative example, but I was pretty happy with it, you get full power of clojure when writing css, I for example implemented a few macro helpers on top of garden: https://github.com/darwin/faceboard/tree/master/frontend/styles/faceboard
Thanks @darwin. Well organised css with that >>
macro and all. I was beginning to think hiccup was only ever used inline.
I think the usual advice is to require
GClosure namespaces and import
only types (so things like constructors or enums).
@glenjamin: the funny thing is both will work.
(require 'goog.object)
=> nil
(goog.object.get #js {"a" 1} "a")
=> 1
(goog.object/get #js {"a" 1} "a")
=> 1
It works in the browser REPL at least:
(import 'goog.events.EventType)
=> nil
goog.events.EventType.BLUR
=> "blur"
If fs.writeFileSync
requires fs
to be bound to this
, ((goog.object/get fs "writeFileSync) arguments...)
will lead to an error.
(require '[goog.string :as gstr])
(gstr/format "ok")
TypeError: goog.string.format is not a function
at repl:1:39
at repl:9:3
at repl:14:4
at Object.exports.runInThisContext (vm.js:54:17)
at Domain.<anonymous> ([stdin]:41:34)
at Domain.run (domain.js:228:14)
at Socket.<anonymous> ([stdin]:40:25)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
@crocket this was already discussed before, with you even I think - format for some reason is in it's own namespace, not in goog.string
.
Look at the example here - https://github.com/clojure/clojurescript/wiki/Google-Closure-Library#requiring-a-function
What is https://google.github.io/closure-library/api/namespace_goog_string.html#format?
https://google.github.io/closure-library/api/source/closure/goog/string/stringformat.js.src.html#l39
readFileSync
doesn't require bound this
though:
cljs.user=> (require '[cljs.nodejs :as node])
nil
cljs.user=> (def fs (node/require "fs"))
#'cljs.user/fs
cljs.user=> (require '[goog.object :as go])
nil
cljs.user=> (def read-file-sync (go/get fs "readFileSync"))
#'cljs.user/read-file-sync
cljs.user=> (read-file-sync "project.clj")
#object[Buffer project.clj content here]
(.call fs.writeFileSync fs "/path/to/text.txt" "ok2")
would be smashed by advanced optimization. I'm trying to use advanced optimization without :externs
.
fs.writeFileSync
would be, but then you can do what I did, use goog.object.get
. I don't think .call
would be smashed, though would have to actually check.
Using (object/get fs "writeFileSync")
instead of fs.writeFileSync
or (.writeFileSync fs ...)
is an acceptable tradeoff for shaving off startup time.
Out of curiosity - what's the reason you do not want to write externs? Just because it's annoying to or other reasons?
At a glance, it feels that writing externs is a lot of work if all I want to do is use fs.writeFileSync
or the like once.
If I'm going to use a function or two from various npm modules, writing externs can involve a lot more work than just using object/get.
The thing is GClosure when optimising doesn't touch your :foreign-libs
(or things node will provide for you when you require)
And externs are the way to let GCLosure know that you don't want certain things renamed to refer to the external objects.
Of course, but you pay the cost in verbosity and each time you need to refer to something.
As I said, if I just wanted to use module.function
only once, object/get
is faster. It is ok for small npm modules where references are made only once or twice at most.
Purescript imports javascript functions individually via FFI. I wanted to do something like that in clojurescript for one-off references.
For larger modules or large programs, externs make sense. But, since there are just too many npm modules out there, I don't want to maintain externs for those modules on cljsjs.
Sure; just wanted to underline that writing externs for one or two functions isn't as much work as you think it is. But I can understand not wanting to do that if you feel just def
ing things you need is enough.
Well, you don't have to put externs in cljsjs
if you don't want. It's not a requirement to use them - you can just keep them in a folder in your project.
@crocket what do you mean by startup time? :advanced
should not be very different from :simple
in that regard
@thheller: For a very simple program, a javascript file compiled on :simple
optimization starts up in 0.2 second, and a js file compiled on :advanced
optimization starts up in 0.1 second.
@crocket without rigorous measuring - making assumptions about timing makes little sense
as to the gap widening in bigger programs - even bootstrapped ClojureScript loads in under half a second
@crocket: in anycase, this isn’t something we care about and we’re not going to spend anytime on it the advice I’ve given about this holds - just use
:none
On nodejs land, :none
causes tooling issues even if you don't care about loading time.
I know that it is my issue, and I don't expect anyone else to take care of my issues unless I'm paying.
I'm probably not going to become a clojurescript pioneer on nodejs, so I may wait for months or years.
My crude calculation is that if a nodejs program requires 10 simple cljs npm modules, each of which consumes about 700kb-1mb on HDD, the loading time could go beyond a second on older machines. A second of loading time could make a difference on sysadmin's patience. Time could solve this problem by increasing SSD and CPU speed, though.
@crocket cljs as npm modules is problematic since each basically will ship their own version of cljs
Ah, I think I understand what I missed - you were talking about node modules written in CLJS and that there's no way to optimise out CLJS runtime between those, yes?
Meanwhile, I have object/get
and :externs
for cutting off dead code. object/get
for when it involves more work to define :externs
.
Sorry for sounding like a nagging baby, here. I understand that open source economy is run by the motto, Contribute, pay, or wait
.
so Node.js support could appear if someone in the community has a plan and the time to execute said plan
the problem however is that Node.js and NPM works in a way that’s somewhat at odds with Closure
all these things make a sensible plan more sophisticated than what we already provide less interesting to pursue
it’s pretty clear Google does not care nor do should they given their use of JavaScript. That said what Node.js support we have comes from the small tweaks that Nick Santos (ex- Google) made.
so far we’ve made few changes at all for Node.js - we treat it like pretty much any other JS environment - Rhino, Nashorn etc.
IMO this has worked pretty well - lack of Node.js concessions, tweaks means ClojureScript is more portable.
Summary : On web browsers, and as npm executables, clojurescript is ok. As npm libraries, clojurescript would lead to loading cljs runtime several times. Splitting cljs runtime requires support from google closure, so clojurescript devs are not touching it.
Is there such a thing as a hiccup (or garden) reader, that could be used for example to extract style information?
@crocket: not a bad summary. there is a bootstrapped ClojureScript NPM module now which may be better suited for what you want to do - but it will probably be a non-trivial amount of work to make it useable for actual projects.
@cjmurphy: hrm not aware of anything but given the simplicity of hiccup it might be pretty easy to write a simple recursive function that does what you want
When working with infinite lazy sequences, can I somehow avoid infinite loops when I accidentally realize them?
well I’m probably attacking this the wrong way, but when developing cljs, I often crash the tab, because I think I’m only realizing a finite sequence.
I guess I should not use the browser as a repl, but just do it directly in the figwheel repl with an added take
@grav: so your problem is when debug-printing infinite sequences in repl? there should be some option to limit that
@darwin: yes, it’s a kind of debug printing, but in this case it’s the iterative process that figwheel allows for, so the side effects are rendered in the browser instead of the repl.
then it is fault of the iterative code which consumes that (potentially) infinite data, you should yield back to main event loop once in a while to allow for browser responsiveness (for page refresh)
The iterative development process was what I meant. I’m changing code and watching the browser, and if I accidentally introduce an infinite loop, the browser tab will freeze. If I could introduce an exception that would just kill the stack frame, it would allow me to continue
hey. beginner question. due the down time of clojars i can't run my project anymore. i added some mirrors and seems that it has helped with lein clean but I can't start my re-frame project (lein figwheel dev). any idea how to fix it
@gdulus, there’s a discussion on this very issue going on in #C0H28NMAS right now. Head over and dive in.
i have random compilation issues. after lein clean file change but error always look the same: `{:file #object[java.net.URL 0x65ad7f3f "file:/home/gdulus/Workspace/projects/vanity-portal/vanity-portal/social/src/cljs/social/i18n.cljs"], :line 1, :column 1, :tag :cljs/analysis-error} ANALYSIS ERROR: at line 1 file:/home/gdulus/Workspace/projects/vanity-portal/vanity-portal/social/src/cljs/social/i18n.cljs on file file:/home/gdulus/Workspace/projects/vanity-portal/vanity-portal/social/src/cljs/social/i18n.cljs, line 1, column 1 `
i thought its somehow related to clojars problem, but repo is back and this issue still hits me
seems that for some reason i have StackOverflowError during the compilation. any hint why it can happen?
What's the thing to use for a Cljs Browser repl today?
Can I turn off the auto reloading stuff
That was why I was wondering if there was something smaller
I suppose you can use weasel/piggyback/austin on your own without figwheel, but that it's probably less easier to set up.
It turns out figwheel does let you disable auto reloading, great, thanks