This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-23
Channels
- # announcements (2)
- # beginners (246)
- # boot-dev (1)
- # braveandtrue (3)
- # calva (13)
- # cider (26)
- # cljs-dev (6)
- # clojure (75)
- # clojure-finland (4)
- # clojure-germany (39)
- # clojure-italy (1)
- # clojure-mexico (1)
- # clojure-nl (14)
- # clojure-spec (61)
- # clojure-uk (104)
- # clojurescript (125)
- # cursive (20)
- # datomic (1)
- # emacs (2)
- # figwheel-main (91)
- # fulcro (29)
- # graphql (9)
- # jobs (3)
- # jobs-discuss (9)
- # juxt (13)
- # liberator (2)
- # luminus (1)
- # off-topic (15)
- # parinfer (8)
- # re-frame (70)
- # reagent (35)
- # reitit (24)
- # remote-jobs (5)
- # ring-swagger (3)
- # shadow-cljs (127)
- # spacemacs (34)
- # yada (6)
I'm mulling over ideas on how to build SharedArrayBuffer backed persistent data structures in clojurescript and I'm thinking it might be possible to make a garbage-less implementation. There's some interesting discussion on garbage collection for functional languages/data structures.
Wow that would be interesting
Interesting discussion here: http://wiki.c2.com/?ImmutableObjectsAndGarbageCollection
But I'm thinking, if all transactions on the SAB are kept behind a swap/deref interface, then we can leave it to whatever host environment to deal with the memory after it has been dereferenced off the SAB.
And if any new "top-level" references are created on the SAB that share structure with other pre-existing "top-level" references, it will share their structure. But if a permutation occurs and no top-level references still reference a particular node, the thread doing the permutation handles the free-ing of any old unreferenced data after the new structure is produced.
And a "top-level" reference would be one created outside of, prior to, any "swapping transaction" into the SAB
So, the thread doing the permutation on the SAB is responsible for all the cleanup/free-ing of un-referenced data, but the algorithm backing the swap/deref interface takes care of all that for the user
And you could potentially have multiple different languages participating in mutating the SAB, via WASM or Graal or whatever
But I'm still thinking through this "top-level" reference vs others. Like, a VectorNode would be immutable, but ephemeral, and only lasts as long as it is connected to some TopLevelVectorRef
And, again, a dereference of that value off the SAB will produce a host-native persistent implementation that is managed by the host gc
Uhm, quite a plan 👍 😄
Need to take the time to read that but it is interesting, thanks for the link!
Yeah, give it a read and let me know your thoughts if anything comes to mind. Seems like the functional/GC angle may be an under-exploited opportunity
Some more links on the subject: http://www.mattgreer.org/articles/clojurescript-internals-vectors/ https://medium.com/@brianwill/functional-game-logic-with-truly-pauseless-garbage-collection-cffecc7b96d7
trying to compile something for http://webtask.io (awesome service, btw!) but there's a limit of 100kb cljsbuild seems to be compiling the npm dependencies in. is there a way to prevent that?
@ackerleytng did you specified the target of the build?
Should be nodejs with optimization simple
You should output bundle to one file like bundle.js. Then you need that bundle and node_modules
Oh mine was set to :advanced. How do I output a bundle
@ackerleytng You can use :output-to compiler flag 🙂
as in :output-to "some/path"
?
that only changes the output path right?
Please try to specify the output-dir to target and output-to "to-some-file-in-root-of-your-project"
then that file together with node_modules is the only thing you need 🙂
hmm... would you happen to have an example? I have
{:id "prod"
:source-paths ["src"]
:compiler {
:output-to "server.js"
:output-dir "target/js/compiled/prod"
:target :nodejs
:optimizations :simple
:hashbang false}}
is that correct?
Perfect
That's correct
hmm. but it still compiles my dependencies into the single server.js
file, which makes it too big
Well I don't think it compiles your dependencies.; OO
Could you please move the server.js to some folder where you do not have node_modules?
then node server.js
If it runs then your node_modules are in the bundle
if not then the problem is with the size of your project
@ackerleytng What is the result?
I can see one of my dependencies (bluebird) bundled in, because i see this in server.js
/**
* bluebird build version 3.5.0
* Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle
*/
My project is just 125 lines of clojurescript, inclusive of comments, I doubt it's the size of my project...thanks so much for your help!
May I please look into the project or it’s not on github?
That’s all
However, right now I am facing dilemma how to set the backend url my SPA is talking to.
@slawek098 what do you mean "how to set"? you mean passing a variable to your code?
I would pass the data in there. so instead of calling init without any arguments like so https://github.com/shadow-cljs/quickstart-browser/blob/master/public/index.html#L10
an alternate option is via :closure-defines
https://shadow-cljs.github.io/docs/UsersGuide.html#closure-defines
I've got one more question. I've got „mixed” project with lein and shadow-cljs (lein for backend, shadow for frontend, some .cljc
code is shared)
Like, let shadow cljs build js file and then include it in lein build, and host it with ring?
well you can either run shadow-cljs release your-app && lein uberjar
and just make sure your :output-dir
is included in the uberjar
or embed shadow-cljs into your lein project.clj
and use an alias to run the release task before calling uberjar
as far as the JS is concerned your ring app only needs to serve the file. nothing more.
https://stackoverflow.com/questions/7816465/serving-static-files-with-ring-compojure-from-a-war
if all fails you can always @veddha.riady
(fulcro.client.dom/style "@media {..}")
there's #fulcro I don't use FulcroHi all, is anyone here using cider with figwheel-main? I'm trying to get a minimal figwheel-main/reagent project setup. I used the figwheel-main template and then followed the instructions from cider. I get an error loading cider when trying to resolve cider/piggieback/wrap-cljs-repl
. Could not locate cider.clj on classpath
. I'm a Clojure/Clojurescript noob and not too sure how to begin debugging issues like this.
I added cider/piggieback
to both my project's dev dependencies and to my profiles.clj
just to try to make sure it's being included
ok, good to know. Thank you! Figwheel is really awesome 🙂
hmm, i did add that inside the dev map like {:dev {:repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}}
do I need to add it in my profiles.clj or something?
(i was referring to the project.clj before)
My cider-default-cljs-repl
is nil
so I guess not
when you launch cider it should ask you whether you want to use lein, unless of course your only have a project.clj in your directory
nope. Just dev.cljs.edn
I updated it last night I think, let me try to get the version
CIDER 0.18.0snapshot (package: 20180822.1325)
thank you
Evaluating an alert expression in emacs and then seeing the alert happen is magical
Do you know of any documentation about the /
vs .
. I'd just like to learn about what they're doing exactly. I know that /
is used to access a function inside a particular namespace, but I'm not sure about the dot.
So when you do cider/piggieback
in the dependencies is that including the cider.piggieback
namespace?
And is that a language thing or something that just happens to be the case here? Like would it be com.bhauman.figwheel-main/some-fn
?
cider
is the group-id in cider/piggieback
like how org.clojure
is the group-id in org.clojure/clojure
[:> bs/NavItem {:event-key 2 :href "/config/system"} [bold-if-active :config-system "System config"]]
Opening
kinda works (more on that later, because API url is wrong), but click on „System config” link redirects me to
instead of
hi all!!!! Trying to use figwheel-main but it is not giving me a repl. tryed: lein new fighwheel-main new.app
Is it the extra "h" in fighwheel
?
`(defproject nu.app "0.1.0-SNAPSHOT" :description "FIXME: write this!" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :min-lein-version "2.7.1" :dependencies [[org.clojure/clojure "1.9.0"] [org.clojure/clojurescript "1.10.339"]] :source-paths ["src"] :aliases {"fig" ["trampoline" "run" "-m" "figwheel.main"] "fig:build" ["trampoline" "run" "-m" "figwheel.main" "-b" "dev" "-r"] "fig:min" ["run" "-m" "figwheel.main" "-O" "advanced" "-bo" "dev"]} :profiles {:dev {:dependencies [[com.bhauman/figwheel-main "0.1.5"] [com.bhauman/rebel-readline-cljs "0.1.4"]] :resource-paths ["target"] ;; need to add the compliled assets to the :clean-targets :clean-targets ^{:protect false} ["target"]}})`
Hello all, I’m trying to use :npm-deps
to install some node modules into my project. It’s generating the node_modules
directory but not actually downloading them when I run lein deps
. I also have the :install-deps
flag as true.
The npm-deps
is an option passed to the cljs compiler, I don't think it's visible to leiningen at all. You'll need to actually compile something to get it to download.
my javascript (compiled for nodejs) is 176K after :advanced
compilation, and I see
/**
* bluebird build version 3.5.0
* Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle
*/
in the compiled code. How do I compile without pulling in these dependencies that can remain in node_modules
?actually... the simplest hello world
(defn ^:export webtask-function
[ctx cb]
(cb nil "hellozzz"))
(set! (.-exports js/module) webtask-function)
is already 92Kb. was trying to use clojurescript for a serverless application but i guess not.thanks!