Fork me on GitHub
#lumo
<
2017-08-16
>
rberger06:08:30

Have an example script doing the kind of things I hope to do with Lumo and Clojurescript as a replacement for Bash scripts at https://github.com/omnypay/semver-from-git I ended up not being able to use npm libraries for things like git operations and instead just shelled out to the git executable. Main problem was the issue of almost all the npm libraries being async oriented. I couldn’t figure out how to cleanly use core.async (andare) since there is no support for blocking operations in JS. I could make it work, but could not figure out how to still have nice bitesized functions that return values. Everything ended up returning the channel of the go block. I was able to publish the program as an npm package though which was one of my key goals. https://www.npmjs.com/package/semver-from-git Would appreciate any constructive feedback or suggestions for improvement! I’m hoping it can help increase the number of full fledged examples of how to use lumo.

dominicm08:08:58

@anmonteiro could a macro be built using js* for writing functions like async function() { }?

pesterhazy10:08:01

@rberger looks like the github page 404s?

pesterhazy10:08:11

honestly I think core.async may be overkill for a shell script in many cases anyway (plus I think I remember hearing that it takes a long time to compile in lumo)

pesterhazy10:08:31

why not start with callbacks/promises and go from there?

rberger16:08:42

I am having problems thinking how to do callbacks / promises in a script. Any examples? (I learn best from examples)

stbgz00:08:02

the calvin source code is using andare with callbacks

stbgz00:08:15

that might help you

hlolli12:08:31

takes long time to compile, but you can always direct lumo to a cache directory and then it's subsecond after that.

richiardiandrea14:08:11

has anybody ever seen:

failed compiling file:out/cljs/core.cljs
	 (new)
	 Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:1934:200)
	 (evalmachine.<anonymous>:609:25)
	 Function.lumo.compiler.compile_file.cljs$core$IFn$_invoke$arity$4 (evalmachine.<anonymous>:616:4)
	 (Object.lumo$closure$compile_file)
	 (evalmachine.<anonymous>:1625:21)
	 (Object.lumo$closure$_compile)
	 (Object.lumo$closure$compile_from_jar)
	 (evalmachine.<anonymous>:1660:21)
	 (Object.lumo$closure$_compile)

should never happen!
	 (new)
	 Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:1934:200)
	 Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$2 (NO_SOURCE_FILE <embedded>:1934:88)
	 (Object.lumo$io$slurp)
	 (Object.lumo$compiler$emit_cached_core)
	 (evalmachine.<anonymous>:482:28)
	 Function.lumo.compiler.with_core_cljs.cljs$core$IFn$_invoke$arity$2 (evalmachine.<anonymous>:231:85)
	 Function.lumo.compiler.compile_file_STAR_.cljs$core$IFn$_invoke$arity$4 (evalmachine.<anonymous>:461:41)
	 (evalmachine.<anonymous>:586:41)
	 Function.lumo.compiler.compile_file.cljs$core$IFn$_invoke$arity$4 (evalmachine.<anonymous>:616:4)

richiardiandrea14:08:29

trying a simple: lumo -c src scripts/lumo_build.cljs

pesterhazy15:08:26

it's when you slurp the wrong type

pesterhazy15:08:08

I didn't see it during compilation though?!

richiardiandrea15:08:04

yeah I don't know what I am doing wrong (hopefully Antonio can have a look there)

anmonteiro16:08:44

@richiardiandrea try setting source-map to false

richiardiandrea16:08:33

so that means I need to have source-map-support in node_modules or it is a real little bug?

richiardiandrea16:08:42

(I can report it)

anmonteiro16:08:40

It's reported

anmonteiro16:08:18

This is because we're blacklisting cljs/core.js.map from the binary

richiardiandrea16:08:24

k cool thanks a lot

rberger16:08:35

@pesterhazy Oops, forgot to make it public, https://github.com/omnypay/semver-from-git is now public

rberger16:08:42

I am having problems thinking how to do callbacks / promises in a script. Any examples? (I learn best from examples)