cljs-dev

thheller 2025-06-11T08:14:36.913599Z

FWIW I don't think a generic morph thing is all that useful. kinda also need the rest of the stuff, like assuming you have some server generated HTML, where do you get the next one from? by which method? by which event? initiated from the server or the client? you really need more of a library for that, at which point the library would include the morph thing. Not saying that wouldn't be useful, but "just a morph function" doesn't do much, and is also kind of the least interesting thing.

👍 1
dnolen 2025-06-11T12:53:31.345029Z

Just don't agree, you do not need the rest of the stuff because you don't care what the rest of the stuff is

dnolen 2025-06-11T12:53:55.335819Z

and it's unlikely you'll imagine what those things will be. people will figure it out.

dnolen 2025-06-11T12:55:18.167809Z

in anycase it's doesn't really matter that much impact-wise, there's plenty of things in GCL that various people do and don't use depending on their needs.

borkdude 2025-06-11T12:55:32.719469Z

I don't have a strong opinion on whether such a thing should or should not be included, but right now people can include Idiomorph using a script tag, no NPM needed?

borkdude 2025-06-11T12:56:13.332119Z

The issue about making CLJS work with libraries from script tags, using the js$ require thing would be interesting to me in this area

dnolen 2025-06-11T12:56:32.554439Z

if you want to use idiomorph having this thing won't change that.

borkdude 2025-06-11T12:58:37.689559Z

sorry, then I misunderstood. I thought you were going to include Idiomorph itself as a goog module

dnolen 2025-06-11T12:59:05.197759Z

haha, no a whole new goog.dom.morph is what I'm proposing

borkdude 2025-06-11T12:59:13.132629Z

gotcha

dnolen 2025-06-11T12:59:18.392359Z

sorry for the confusion

thheller 2025-06-11T12:59:23.546089Z

I'd totally drop the goog. shit ... whats the point in that 😛

➕ 1
dnolen 2025-06-11T12:59:33.124079Z

yeah including idiomorph no way

dnolen 2025-06-11T13:03:57.951969Z

haha, sticking w/ goog is a bit odd, but cljs is also not great for a js lib.

dnolen 2025-06-11T13:04:02.516529Z

org.cljs ?

dnolen 2025-06-11T13:04:33.444139Z

whether I get around to doing this morph thing, a convention around additions to GCL for our own stuff would be good.

thheller 2025-06-11T13:06:41.019999Z

doesn't really matter in the end. I don't agree that this needs to be a concern of cljs itself, so I'd always put it in a library. if it turns out useful thats a better distribution method just by not being "shackled" by CLJS Jira ways of doing stuff. That hasn't been exactly "contribution friendly"

dnolen 2025-06-11T13:08:59.132109Z

that's a reasonable point - but a I think a truly primitive morph thing is kind of one-off thing. not something you're continually developing in a active sort of way all the time.

thheller 2025-06-11T13:09:47.573929Z

the fact that there are so many morph libs suggests that is not true. there are various strategies for doing this, all with different trade offs

dnolen 2025-06-11T13:11:22.341169Z

I don't think there are that many, the ones I posted are the most canonical

dnolen 2025-06-11T13:11:58.294909Z

nanomorph shows conceptually that it's a very simple thing. Phoenix Live View uses morphdom, and idiomorph is Rails, htmx, and datastar.

dnolen 2025-06-11T13:12:44.313819Z

idiomorph of the 3 does the best job of preserving the UI state far as I can tell, I think Rails switched to that from morphdom.

dnolen 2025-06-11T13:13:04.560329Z

having this much prior art (and none of them are that new) is a good thing.

borkdude 2025-06-11T13:14:26.646269Z

would goog.morph.dom (or why not cljs.morph.dom or whatever) provide a different impl than idiomorph? then why not straight up copy and wrap it?

dnolen 2025-06-11T13:14:58.997659Z

a different impl - would like to abstract the tree rep

borkdude 2025-06-11T13:16:38.325249Z

would love to see a POC of an CLJS app/website using this

dnolen 2025-06-11T13:17:31.222649Z

I mean one advantage to be honest is you could get on the HTXM style bandwagon out of the box w/o reading about all the JS stuff and making assessments

dnolen 2025-06-11T13:17:42.760609Z

figuring this stuff is not a small amount of work

borkdude 2025-06-11T13:18:08.166079Z

HTMX/datastar already make this choice for you, kind of.

dnolen 2025-06-11T13:18:34.105209Z

right you have to eat everything all at once, I don't like that.

dnolen 2025-06-11T13:18:47.133689Z

vs. here are some primitives and they are Clojure first

dnolen 2025-06-11T13:19:12.396299Z

HTMX/datastar also seriously un-Lispy - they are great, but I wouldn't want to use them as is.

➕ 1
dnolen 2025-06-11T12:58:00.422929Z

re: the global thing, I think all options except new (:require ...) syntax are dead. Later can consider sugar, but against addressing that in the first pass.

borkdude 2025-06-11T12:58:51.662419Z

first pass of what exactly?

dnolen 2025-06-11T13:00:21.535049Z

dealing w/ globals directly as a require construct

dnolen 2025-06-11T13:00:30.750079Z

i.e. like macros, special syntax

dnolen 2025-06-11T13:00:38.840849Z

the sugar stuff appeared way later

borkdude 2025-06-11T13:01:05.340889Z

I see

borkdude 2025-06-11T13:07:07.847649Z

I'm not totally clear what you mean by "sugar". Do you consider (:require ["js$..."]) sugar? What would be the non-sugar variant of that?

dnolen 2025-06-11T13:09:41.809249Z

I linked to the variant I'm interested in, not interested anything beyond that.

dnolen 2025-06-11T13:10:15.661049Z

you can look at the current ns parsing to see how we desugar - it's pretty annoying - a lot of complexity.

borkdude 2025-06-11T13:10:48.515709Z

oh sorry for not noticing that. yeah, either way would be great. the sugar is a bit annoying to implement, I've implemented it in squint and SCI too

borkdude 2025-06-11T13:11:26.444349Z

I assume you mean the $default.foo.bar sugar right

dnolen 2025-06-11T13:15:53.784249Z

anything that's merged in w/ normal :require

souenzzo 2025-06-11T13:31:45.173989Z

and if it wasn't a require (ns foo.bar (:require ...) (:globals [window.location :as loc] [MyCustomGlobal])) And use as

(location/reload)
  (.send (MyCustomGlobal.) ...)
In fact, it is not requiring anything it is just telling "hey compiler, trust me, this global var exists in my runtime"

borkdude 2025-06-11T13:33:23.601289Z

That's what @dnolen proposed in the comment he linked to:

:require-global
require is still a reasonable word to use. require means: I depend on this

👍 1
borkdude 2025-06-11T13:36:30.591019Z

(:require [js/foo :as-alias dude])
:P

borkdude 2025-06-11T13:36:44.825959Z

we've been through this already, no js/ magic in require