Fork me on GitHub
#clojure-europe
<
2023-09-13
>
schmalz07:09:40

Morning all.

maleghast08:09:40

maidin mhaith!

ray08:09:50

Good morning

❤️ 1
ray08:09:50

got bitten (again) by a missing clj->js today. The ongoing of friction (js interop and promises) are still reducing the joy of my experiences with CLJS. Does everyone else just :man-shrugging::skin-tone-3: ?

borkdude09:09:10

Use #C03U8L2NXNC;)

ray09:09:34

you saying it's ready for production?

jkxyz09:09:40

I almost never use clj->js - sometimes we use cljs-bean at work for objects, but normally I prefer to construct a JS object using the #js reader tags or use an explicit conversion like into-array. There are also many cases you don’t need to convert anything - CLJS vectors are Iterable so you can pass them directly to lots of functions

ray09:09:35

maps though ... and yes #js is the same ie forgettable

jkxyz09:09:23

True that #js is easy to miss especially in nested objects. I’ve not thought about it in ages though, and we do lots of interop with ProseMirror and other React libraries. Maybe it just gets better :man-shrugging: So helpful, I know

1
ray09:09:04

I'll put you down as a :man-shrugging::skin-tone-3: @UE72GJS7J

jkxyz09:09:12

The older I get the more :man-shrugging: I become

ray09:09:28

there are 3 main interop ways that I see • #js / clj->js • cljs-bean • applied-science.js-interop which demonstrates the .... innovation | :man-shrugging::skin-tone-3: | 😖

ray09:09:34

but it's definitely more friction than CLJ

borkdude09:09:40

> you saying it's ready for production? chicken and egg, the more people will be using it, the more ready it becomes. it's easy to try out since it works on a file by file basis though. you can integrate it in an existing CLJS project to e.g. write a few things and use those from CLJS

1
pez09:09:32

I think I’ve gotten better at starting to suspect that I have the problem. Not saying I am good at it yet, but at least I feel less of the friction.

pez09:09:39

Orthogonal, but anyway. I think @U06F82LES has some advice around not reaching for clj->js and js->clj too automatically, but to consider alternatives. I think it is mostly for performance reasons.

ray10:09:46

think_beret is it because the emitted JS should be compatible with version of JS when Map was not a class (eg pre ES6)?

pez12:09:05

Maybe it doesn’t apply to clj->js, but hey, I did say it’s orthogonal 😃

borkdude12:09:28

orthogonal is an overloaded word

😂 3
ray13:09:47

it doesn't apply to clj->js ... cos afaik there is no other way to do it (please don't say #js all the way down cos yeah I could but I'm not gonna)

ray15:09:58

I've used that when reading stuff but not when calling into JS - I'll take another look

mccraigmccraig15:09:05

and for promise stuff, i often find promesa's https://github.com/funcool/promesa/blob/master/doc/promises.md#let can clear up a mess

ray20:09:11

yeah - I'm a heavy p/letter even though that sounds slightly racy 🙂

ray20:09:59

promesa in general though is quite infectious :man-shrugging::skin-tone-3:

mccraigmccraig20:09:14

I've recently been using https://github.com/yapsterapp/a-frame to avoid infection - it's an async BE port of re-frame - the coeffect+effect handlers are mostly promise-based, but it lets you have pure business logic

👀 1
borkdude13:09:23

dudez and dudettez and all others, look, import .cljs from js!

import { the_number } from "./calc.cljs";
😁 https://github.com/borkdude/bun-squint-loader/blob/e5a3cf3e94243f1e6d5d3892d47a2b794a601480/index.js#L1

catjam 4
lread13:09:34

is this fantasy or non-friction?

😆 4
teodorlu13:09:35

I’ve been refactoring some code lately. Made me think about how much of this can be simplified with the REPL & clojure-lsp! I’m doing something like this, and I’ve been enjoying the process: 1. Deprecate function I want to stop using, another function that does it ’right, write “deprecated, use new thing” in old thing docs 2. Move usages over to the new thing (using find references with LSP) 3. Find the nest deprecated function with a piece of REPL code. I was kind of surprised that “look at the metadata of every var in process was a instant. But it’s already in memory, so perhaps I shouldn’t be surprised! I guess filtering out irrelevant namespaces early helps.

ericdallo15:09:08

A LSP code action Deprecate function in favor or new one would be nice indeed

👍 1