Fork me on GitHub
#clojure-uk
<
2020-10-14
>
dharrigan05:10:03

Good Morning!

6
dharrigan08:10:35

I do like developing at the repl - I can try out things so quickly, code it up as a test, then try it out and bingo - just works 🙂

alexlynham08:10:13

it's the thing i miss most about clj tbh

mccraigmccraig10:10:28

there's no reason you can't repl in js-land is there @alex.lynham?

alexlynham10:10:25

you can rig up a typescript repl in emacs tbf, but it's just naff

alexlynham10:10:03

i mean, i already find the cljs repl less useful than the clj one, but everything is async and you can't await stuff easily, so it's just more hassle than writing a unit test tbh

mccraigmccraig10:10:39

i've used something like this in cljs repl: (defn wait-print [p] (.handle p (fn [success error] (if error (print error) (print success))))) ... and something similar to collect the value/error in an atom - that should work in js repl too ?

alexlynham10:10:27

yeah i used a similar hack when i was doing cljs/sls stuff

mccraigmccraig10:10:49

i found it transformational for cljs dev once i got a node-repl going, and could use it pretty much like a clj repl - although CIDER test runner doesn't work, which was sad

alexlynham10:10:03

idk, it's about going with the grain - it's a pain in TS so i don't do it

alexlynham10:10:09

it doesn't really add value

alexlynham10:10:52

and the test watcher for our 400+ tests (db, unit, integration, handler) run in sub 35s, and only run the related changed ones, so that's a better feedback mechanism

Ben Hammond10:10:30

anyone here used MongoDb? I've got a n00b question...

alexlynham10:10:54

not for a while

alexlynham10:10:06

@rickmoynihan are you folks still using it for bits and pieces?

rickmoynihan10:10:23

over my dead body 😆

rickmoynihan10:10:13

its only on some legacy stuff providing a small database of users

alexlynham11:10:04

ah i did wonder if zib (memory, is that right?) had meant it went bye bye

Ben Hammond10:10:45

I'm trying to spin up a trivial replicaset for an integration test; everything running locally; every time I try to make a change I get a 'Command failed with error 10107 (NotMaster)'

Ben Hammond10:10:05

its never worked as a replicaset, so I'm sure I've just misconfigured something

Ben Hammond10:10:28

somehow the initial Master election never happens, maybe?

Ben Hammond10:10:33

rs.status()
{
"errmsg" : "no replset config has been received",
"code" : 94,
"codeName" : "NotYetInitialized"
...
}
I guess that's my problem

dharrigan11:10:05

I detest Mongo

dharrigan11:10:22

We are in the process of slowly moving away from Mongo to Postgresql

dharrigan11:10:41

such a mistake for us to even introduce Mongo into our architecture

alexlynham11:10:46

on current project we're using postgres as a nosql store

Ben Hammond11:10:05

rs.initiate() run from mongo console seems to help

3
dharrigan11:10:05

yeah, I use pg to store json too, and key/value pairs (hstore). works great

alexlynham11:10:13

it's so stable and AWS aurora supports the PG API so

Ben Hammond11:10:26

I managed to avoid Mongo until 2020

alexlynham11:10:40

we've got aws aurora in prod and treat that like a no maintenance nosql store without the faff of dynamo

Conor11:10:57

Hats off to their marketing department though, they're playing a blinder

alexlynham11:10:00

so if we do need to do complex admin tasks for some reason we can run ad hoc queries which is nice

Ben Hammond11:10:05

WebScale innit

Ben Hammond11:10:26

it does make me appreciate the thing that datomic has got right

dharrigan11:10:30

Does anyone have recommends for a templating library, i.e., a template + vars == rendered content. This is not for webpages. I'm thinking of using Thymeleaf (which I've used before)

dharrigan11:10:39

(it's for email templates)

dharrigan11:10:59

I would have to do thymeleaft interop, which is no biggie...

mccraigmccraig11:10:02

in recent memory i've used StringTemplate... which was meh... and multiple mustache variants, both home-rolled and imported - i'd probably look at https://github.com/fotoetienne/cljstache , although i haven't used it myself

dharrigan11:10:55

looks very good. simple, no other dependencies.

dharrigan11:10:24

have a 🍺 or 🍵 on me!

6
dharrigan13:10:44

works great btw, very easy to integrate. w00t!

alexlynham13:10:02

even in typescript vs js

alexlynham13:10:30

i reckon conservatively 10% of our code base is in some way basically just dealing with JS being shite at handling null/undefined

thomas14:10:51

most of the JS bugs I had to deal with were related to that

alexlynham14:10:04

infuriatingly typescript helps to a point but tends to kick you when you're down

alexlynham14:10:16

wasn't really an issue i've ever had in cljs

alexlynham14:10:45

think the compilation story x lisp parens makes it easier to catch errors at dev time even tho it's dynamic not static

rickmoynihan14:10:48

nil is certainly still a problem in clojure/script but it can’t really have a bullet proof design for it, given it works on platforms where the billion dollar mistake (now surely many, many times that) already exists. It does however manage to insulate you from many problems handling it, by appropriately nil punning in the seq/core api’s etc. I can’t really speak for whether typescript does it more or less than clojure, I’m sure it helps a fair bit though.

alexlynham14:10:36

i think the design of the core api is the key really

alexlynham14:10:43

because at dev time TS helps a lot

alexlynham14:10:13

but at runtime you get some DEVASTATING (and i use all caps here because i think they are justified) edge case bugs

alexlynham14:10:38

just stuff you take for granted in clj(s) too like what happens when you destructure something nested and a key isn't there

alexlynham14:10:05

in some cases JS will throw, in some cases it's undefined, it's still a wild west even with the TS layer sometimes