Fork me on GitHub
#beginners
<
2016-07-16
>
richiardiandrea00:07:34

@seancorfield: it seems that db namspaces are a kind of particular case. Meaning, if I see functions in yournamespace.db.query I already know that I should not put them in an STM and therefore you can leave the ! out. The problem is with other places, where I prefer to always add it, even if there is no system visible change, in order to prevent any misuse and catch the attention of the reader. I don't want any serial killer at my door (including myself :relaxed:)

seancorfield00:07:49

@richiardiandrea: And that’s a perfectly valid convention to follow IMO.

krchia00:07:14

is there a way to exit a function prematurely in cljs?

krchia00:07:33

there’s this monster function in js with several return; and i’m not sure what to replace them with

akiva00:07:26

@krchia, sure, if you specify the condition with some branching logic and know that whatever’s last in that branch is what the function will return.

krchia00:07:03

yeah, that’s the problem.. there’s conditionals peppered all over inside the function with returns

krchia00:07:15

that’s for a direct js->cljs translation though

seancorfield00:07:50

You’re going to have to refactor it into a series of smaller functions, and probably use some-> or cond-> (i.e., threading).

seancorfield00:07:32

This is one of the wins of cljs over JS: better, more maintainable code structure — because you’re essentially forced to do that 🙂

akiva00:07:40

That’s exactly what I was going to type next. [coughs]

krchia00:07:16

ok, i guess i can’t translate mindlessly anymore

akiva00:07:55

And never be afraid of having an army of smaller functions as long as they’re clear and predictable.

seancorfield00:07:22

A mindless translation will be very unidiomatic cljs...

naomarik01:07:13

any recommendations for deployment strategies/libs/guides?

akiva01:07:31

Matters what your target is, really. I went with dokku on an Ubuntu installation for a bit but after awhile it was just easier for me to generate an uberjar and use sftp to get it to my server.

akiva01:07:04

It’s not at all automated, unfortunately, but it works in the small.

naomarik01:07:37

i'd prefer a completely automated setup, something that doesn't require me to ftp any jar (i might be on phone connection for hotfix for instance)

naomarik01:07:55

i could probably write some capistrano recipes but wondering what everyone else is doing

seancorfield02:07:52

@naomarik: We have automated build / test / deploy scripts but there’s still manual intervention. We run a private Apache Archiva instance as a mirror for Maven/Clojars and a repository for our own published libraries. We’re moving toward Docker in general to help automate things.

seancorfield02:07:42

We also run a REPL server inside all our long-lived processes so — if absolutely necessary — we can jack in (over SSH / VPN) and debug and patch a live, running process.

seancorfield02:07:14

We’re moving toward CD as an end game but we’re aways off that yet 🙂