Fork me on GitHub
#clojurescript
<
2022-05-05
>
James Amberger14:05:21

anyone know how to get rebel functionality in my shadow-cljs repl?

Intelo15:05:52

I have some queries. I have a huge react, typescript frontend and node,express,typescript based backend app. Thinking and attracted to convert that to clojure. Dreamed of smallest and smartest codebase as primary reason. Where can I discuss this?

dgb2318:05:01

This seems to be a huge undertaking. A good idea would probably be to first attack the backend and then the state management and backend communication/plumbing of the frontend, while keeping the react components as is (cljs libraries are good at using react components).

Intelo18:05:32

so first convert the nodejs side? so this won't be a javascript app anymore. why not just write the backend in pure clojure and not clojurescript then? the front and back only would have one thing in commont "json".

dgb2318:05:54

Yes, Clojure on the JVM.

Intelo18:05:53

So backend can be clojurescript but it can also be clojure. I wonder what might be the difference? I mean what could I do in clojure that cannnot be done in clojurescript or viceversa

dgb2318:05:57

You get the most bang for your buck if you focus on the parts that are about domain logic, information processing and plumbing out of Clojure.

Intelo18:05:08

what would be the fate and what are the recommended ways of doing this?

dgb2318:05:35

The recommended way is to use Clojure (JVM) on the backend. The libraries there are more mature and it's a paved way. ClojureScript on Nodejs is more of a niche thing and not the primary use case for ClojureScript. It can be done, I have done it too and many others. But not the recommended way.

👍 1
Intelo18:05:35

I see there are not many resources out that that explain these aspects.

Intelo18:05:47

I see. ok. so is there nutshell that would tell the brief difference? I know cljs runs on JSVM and cannot have what clojure can do.. What might be those things ?

Intelo18:05:09

why its not recommended to use clojurescript

Intelo18:05:31

I have many questions. What about query langauge. I use https://knexjs.org and didn't found clojure alternative for postgresql

Intelo18:05:41

also, json converstion etc..

dgb2318:05:54

There are two options you might like

dgb2318:05:08

one is Hugsql and the other is honeysql

dgb2318:05:39

they attack it from different perspectives - try them out a bit and see which one works for you.

dgb2318:05:42

You'll also need a server and a routing library. For the server I can recommend ring, for routing people use compojure or reitit.

dgb2318:05:24

There are other options but those I can recommend, especially if you're doing this the first time around.

Intelo18:05:16

I see. that was informative!

Intelo18:05:17

what are the limitations of clojurescript that are not in clojure and vice versa?

dgb2318:05:41

It's really more a library/ecosystem/tooling thing

dgb2318:05:05

There are little bits and pieces that are different but I wouldn't worry about it at this point.

dgb2318:05:36

The focus of ClojureScript is definitely frontend

Intelo18:05:33

So I can't run macros and advanced functions in clojurescript that belong to clojure?

Intelo18:05:56

so clojurescript is just like typescript to js? just a compiler?

Intelo18:05:20

what are other hickups that web developers face while using clojurescript and clojure respectively?

dgb2318:05:50

The main difference is really how they treat and interop with the host language and the tooling and libraries around that. Yes you can think of ClojureScript as something similar to Typescript.

Intelo18:05:21

any examples that clojure can do and clojurescript cannot or vice versa?

Intelo18:05:39

JS dont have types, I used Typescript for that. Is it likely to get into same issues with clojure/clojurescript? I know there are a couple of ways to handle this but is it needed? whats your point of view? types in clojure https://youtu.be/OzGVgPY9W-w?t=404

Intelo18:05:25

I don't know how much you would agree with this https://youtu.be/_J3x5yvQ8yc?t=428

Intelo03:05:39

Ok, I guess I asked too much 🙂

dgb2306:05:55

It's more of a time thing! Some of these questions are really open ended and a bit vague. I suggest you start digging/playing/learning - then your questions become more crystallised, start a thread for a specific one and focus on one discussion at a time 😄

dgb2306:05:44

I can say something on types in Clojure though: I don't miss them in Clojure. There are languages that really make use of type systems and hinting and that's a good thing, but Clojure has a different focus and that is also a good thing. If you care about structural integrity and invariants of your data you can always write specs, they are more expressive than type systems, because they are arbitrary predicates, and you can do more with them than with types - but you don't get the same guarantees as with a type system.

dgb2306:05:58

Also they cover different use-cases, so it's better to think of them as their own thing.

Intelo08:05:19

This was informative again

Intelo08:05:27

Any comments about the video links I gave 🙂 ?

Intelo08:05:03

I meant the video about super powers of clojure/lisp

dgb2312:05:21

Eric Normand is well respected within the community. I haven't seen the video though.

kennytilton13:05:30

The Norman video is 25 minutes to say Lisp is incredibly powerful, and that there are no libraries because you do not need them because Lisps are so powerful. Is our head spinning yet? His proposed solution is for everyone to stop leveraging the power, slow down, and work on libraries we do not need. Meanwhile, I have been writing Common Lisp and Clojure apps for twenty-five years, and in the rare case where I could not find a library I needed and did not want to write (OpenGL, GraphicsMagick, FreeType), I wrote the CFFI bindings to a C library, or worked out the interop with a Java library. Too easy?

🙌 2
Intelo13:05:23

@U0PUGPSFR I see. So which parts and notions you do agree with him and what not?

Intelo13:05:41

Is clojure as powerful as any other langauge like java or C++ ? You have been doing it for 25 years. There must be some reason for this consistency? I am really all the ears.

kennytilton13:05:20

I agree that Lisp is super powerful, and that we can get by without libraries for things like parsing because we do not need Antlr; we can parse our own little DSL faster than we can download Antlr. I agree we lack the ability to work amicably with a herd of code camp graduates programming because they heard the money was good, and that Lispers squirm a lot in mindless daily standups. Btw, I once joked (a little) that first thing newcomers do when they discover Lisp is go write their own in C. Look at the subtitle of the video: "What happens when your language is so powerful that small, independent teams can solve their problems without libraries? Does everyone flock to it? Or do you just get a lack of libraries?" Where is the problem? That we have the language all to ourselves? Have you read Paul Graham's "Beating the Averages"?

kennytilton13:05:49

"There must be some reason for this consistency?" Sorry, which consistency?

kennytilton13:05:43

btw, this is fun, but I really do have to get on with pushing ReactJS into the sea today.

Intelo13:05:16

Ok, understood! thank you for the comments. as a side note, I landed to clojure in pursuit of a best or one of the best ROI (return on investment) language. Smartest, cleanest etc. I had to pick one... People often say there is no such thing. Just choose best tool for the job. Well was trying to see if a tool fits most jobs if not all. Hence a further ROI improvement.

kennytilton13:05:33

btw, no libraries? Java has no libraries? Well, this is true if someone cannot be bothered to sort out Clojure/Java interop. They are not the Clojure audience. And if an entire company is looking at Clojure, do they not have one sharp developer who can be the interop whiz? #SeeTheMistake?

Intelo14:05:46

ya.. understood..

Intelo14:05:13

having you see my intentions, any information/ guidance from you would be highly valuable

kennytilton14:05:45

I'll keep my eye out, but you'll get better support from the real Clojure developers. I am on loan from Common Lisp. Best of luck with the massive re-write.

Intelo23:05:44

Ok wonderful. If you do common lisp, what interest you have with Clojure? "Massive re-write"? what notions is behind that?

Intelo10:05:43

@U0PUGPSFR What difference did you found between common lisp and clojure? Any brief or detailed comments?

kennytilton14:05:02

@U03E8B3CCTV "If you do common lisp, what interest you have with Clojure?" I look for jobs using Common Lisp or Clojure. Clojure has more. "What difference did you found between common lisp and clojure? " In both, every expression returns a value, we can write homoiconic macros, and the parentheses are in the right place. Otherwise, Clojure is a lisp-1 that runs atop Java, JS, or Dart. CL is a vastly bigger lisp-2 that compiles to metal so runs only on metal.

Intelo17:05:31

I see. @U0PUGPSFR it would be of great value if you compare clojure/lisp with other languages like java, javascript, C, C++ or any of your choice. With you years and years of experience of coding, culture, etc, it would be a lot different than what knowledge can be extracted from a blog or something on internet. I mean your words will be uncomparable.

Intelo17:05:38

And of higher value

kennytilton17:05:58

Bu gangdang, @U03E8B3CCTV! 🙂 I found CL when C++ came out and looked ridiculous. Java is a syntax disaster, String tatic typing is a show-stopper. JS is getting better. I do not mind it.

Intelo17:05:42

ok, makes sense but what in the world is getting better in JS? The await/async? or OOP as wrapper for prototypcial inheritence or Typscript

kennytilton18:05:57

TypeScript?! Remember what we said about strong static typing? I like https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty. Very sophisticated. And it is a lisp-1. btw, "what is getting better?" How long have you followed it? So how is your Clojure coding going?

maverick16:05:20

While running mvn clean install on Clojurscript project getting error as Could not transfer artifact lein-cljsbuild:lein-cljsbuild:jar:1.1.7 from/to Internal nexus PKIX path building failed

thheller16:05:32

what is the full error? could be that your java install is out of date and it can't verify the necessary ssl certs