This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-05
Channels
- # beginners (29)
- # boot (29)
- # cider (54)
- # cljs-dev (99)
- # cljsjs (31)
- # cljsrn (39)
- # clojars (32)
- # clojure (171)
- # clojure-austin (2)
- # clojure-berlin (5)
- # clojure-brasil (3)
- # clojure-greece (2)
- # clojure-italy (1)
- # clojure-korea (11)
- # clojure-spec (202)
- # clojure-uk (166)
- # clojurescript (130)
- # cursive (54)
- # datomic (99)
- # dirac (18)
- # figwheel (6)
- # hoplon (23)
- # lambdaisland (3)
- # leiningen (8)
- # luminus (14)
- # off-topic (11)
- # om (3)
- # om-next (24)
- # onyx (59)
- # planck (25)
- # protorepl (10)
- # re-frame (49)
- # reagent (14)
- # ring-swagger (2)
- # rum (46)
- # schema (1)
- # slack-help (6)
- # specter (7)
- # testing (7)
- # untangled (115)
- # yada (1)
is there a specific list of field names that are preserved for .method
/`.-prop` with advanced compilation?
@tbaldridge I’ll be doing that shortly as part of better CLJS REPL support.
@eyelidlessness I believe these are the externs used by default: https://github.com/google/closure-compiler/tree/master/externs
@darwin i literally just found that. thanks!
trying to track down what is likely a munging of some DOM property in the drag-and-drop API
without waiting for dozens of slow compiles to isolate it
[shameless plug] checkout my library https://github.com/binaryage/cljs-oops
@darwin i’ve seen that and considered using it!
may still yet, but not ready for that big a change just yet
what kind of impact does it have on page weight? have you measured?
i would imagine it’s quite small
interesting!
here you can see some samples: https://github.com/binaryage/cljs-oops/tree/master/test/transcripts/expected
how does it work? i started looking at source then saw there’s a lot of code there
it implements a mini-compiler for “selectors”, it tries to do as much as possible at compile time, but if it fails, it has a secondary code path which implements the same functionality at runtime
interesting
here you can see what it generates under dev mode: https://github.com/binaryage/cljs-oops/blob/master/test/transcripts/expected/oget_dev.js
really neat
i think i just realized what my particular issue is
under advanced builds all diagnostics gets elided, closure compiler does its magic, in this case it elides most of the code: https://github.com/binaryage/cljs-oops/blob/master/test/transcripts/expected/oget_static_core.js
i’m trying to use an arbitrary property with the html5 data api
e.g. <div data-foo=”bar”>
and thatDiv.dataset.foo
yeah i just spotted it, and it made perfect sense.
I see that I can put npm deps in the dev profile, but then they get installed under node_modules like everything else. How do I then stop them being included in deployment jars etc?
if it does not yet, you can implement your own using node.js apis: https://nodejs.org/api/fs.html
I don’t follow lumo that closely, but I think it is planned to support std clojure functions
Right, @selfsame, you can use Node's I/O capabilities. In the future Planck and Lumo may both implement a common set of I/O interfaces so that code is portable.
If you want portability, I’d consider coding using spit
and then referring it from some other namespace (your own impl if in Lumo, or Planck’s if in Planck)—that way you can muck with the ns as needed to port.
foo.cljc defines a macro that foo.cljc also needs; is there a way to make this work when compiling in cljs mode, or is this .impossible?
You can also take that stuff to an extreme with something like https://github.com/cgrand/macrovich
(defn spit [f s] (fs.writeFileSync f (prn-str s)))
(defn slurp [f] (.toString (fs.readFileSync f)))
good enough 🙂Yes. IIRC Planck’s spit
started off with something like that. No need for writer
, IWriter
and all of that machinery for most use cases.
@selfsame: that worked; thanks! apparently there's a recent patch where cljs looks at the require, figures out if it's only importikng macros, and if so, drops it to avlid circular dependency
@mfikes I'm really interested in the idea of a shared protocol implementation for host specific things across different self hosted cljs implementations
As I've been dissecting the nrepl code one of the barriers so far is how to right file reading/writing functions in a vm agnostic manner
I've been thinking about how the different host maintainers could write these functions in such a way that a shared io lib wouldn't need vm specific code in it
So far protocols are the thing that comes to mind, but I'm not sure I understand them well enough to vouch for their usefulness
Yeah, a standard lib would probably define functions (like spit
) and protocols (like IWriter
), etc., but somehow have hooks so that the guts of spit
can be satisfied by any self-hosted environment.
@futuro funny was working on some clr/cljs stuff like that tonight https://github.com/selfsame/ip/blob/master/ip/impl.cljc
@selfsame that's pretty neat. My current target is lumo, but I want this to easily extend to Planck and any other vm as well, so I've been trying to avoid thinking so hard about a node way of handling io
I was reading through the Planck source earlier cause I wanted to see how you'd approached this issue already
@futuro for example https://github.com/juxt/mach/blob/master/src/mach/core.cljs#L42-L54
I just imitated Clojure, especially its IOFactory
framework, and at the bottom have a bunch of functions injected like PLANCK_LIST_FILES
, PLANCK_FILE_READER_OPEN
, etc.
You could imagine a shared library that defines spit
but expects a given environment to inject the actual low-level IO functions.
@mfikes did not know about juxt/mach
that's great thanks! I am happy to many self-hosted tools are popping up
@richiardiandrea me too!
I opened the #cljs-node channel btw exactly for this 😁😁😁
@mfikes when you say "inject" are you talking about the js/PLANCK_FILE_READ_OPEN calls?
Yeah. So, imagine a shared library that is not defined by Planck or Lumo, but is sort of a clean I/O layer that anyone could build code upon, but then different environments could inject the low level IO facilities that that library requires to be satisfied in order to actually function.
There is even a (alpha) replacement for aether
: https://github.com/eginez/huckleberry
By “inject” it could be that there could be a set of dynamic vars that different environments set!
upon initialization.
(def ^:dynamic *write-content-to-file*)
(defn spit [f content] (*write-content-to-file* content f))
or somesuch@fellshard https://github.com/binaryage/dirac/blob/master/docs/about-repls.md really helps me about repls.
With Planck, I tried very hard to not invent anything new, but to copy and closely mimic what Clojure provides.
@mfikes what about relying on the object that gets passed in to adhere to a set of protocols?
@futuro That would be ideal, but I suspect there are a lot of functions in Clojure that you want to imitate that wouldn’t work out easily with a pure protocol-based approach. Just a guess.
@futuro Take, for example a challenging one like
. I like the approach of having an imitation of the
system built in ClojureScript, with native functions at the bottom where needed.
So my thought is to have the host vm's extend the base protocols with their host specific implementations and have the rest of the functions that operate on those protocols
Primarily it seems to be the cleanest way to have clean code, and I'm not really sure how we'd use dynamic vars like you mentioned before
It seems like the kind of thing that would force you to embed code for each platform inside of the library
You'd have the core definitions in one lib, then adapters and implementations in others
@futuro That sounds cool tool. You’ll see what I meant by dynamic vars if you check out (doc *print-fn*)
anybody know how to get added to the list of companies using ClojureScript? http://clojurescript.org/community/companies
@conan: you can submit a PR: https://github.com/clojure/clojurescript-site/blob/master/content/community/companies.adoc
kind of hairy to figure out in js http://stackoverflow.com/questions/4224606/how-to-check-whether-a-script-is-running-under-node-js
I don’t know why and when but sometimes I am losing the ability to set breakpoints in chrome for my code built with figwheel
Does anybody know how to restore the breakpoint capabilities?
I’m using aws-sdk-js
from cljsjs. When using node, I use (def AWS (nodejs/require “aws-sdk”))
- is (:require [cljsjs.aws-sdk-js])
required as well?
How do I get a nice page with the results from cljs.test cases? Preferably a page that reloads and reruns after file changes. I think I have seen this somewhere. I don't mean devcards
Actually, I just realised that for node, I don’t need cljsjs at all - never mind me.
it's pretty nice that just about every js lib on earth is packaged up on npm for us, thanks js ecosystem, we'll just have that for free please.
well obviously thanks to lein and boot for making it easy, putting it within reach of us mere mortals
anyone run into unicode getting like an “A” in front? I’m trying to render an arrow and use “\u00BB” but advanced compilation renders: “»"
I’m not 100% sure where it happens actually … local dev is fine, compiled is not, but it might be someplace else 😜
Hmm, closure shouldn't change strings so Im not sure. Where do you use that in your code?