Fork me on GitHub
#beginners
<
2023-06-06
>
DeepReef1114:06:37

Beside potential lack of developpers in cljs, are there reasons where typescript would be better than cljs?

teodorlu15:06:18

1. Programming when leveraging a type system (Typescript) is different from programming when leveraging a REPL (Clojurescript). 2. Different tools have different ergonomics. Typescript with a https://vitejs.dev/ feels different from Clojurescript with https://github.com/thheller/shadow-cljs. Perhaps have a look at each tool's documentation. 3. Typescript has been developed specifically to let users gradually migrate a codebase from javascript to typescript. You can conditionally enable the type system for certain files while you have a mix of javascript and typescript files. Migrating from JavaScript to ClojureScript cannot be done this way, because Clojure syntax is not a superset of JavaScript syntax. > are there reasons where typescript would be better than cljs? This will come down to preference: who is going to create this system? An approach to mitigate risk using technology a team doesn't have prior experience with can be to build the two copies of the same systems simultaneously. One with Typescript, one with Clojurescript. Do that for a month, and evaluate the results. In which codebase is the team more effective?

2
👍 8
Ed16:06:58

I have done a bunch of work with the AWS CDK tooling. That focuses on TypeScript as it's default language, but also provides a Java implementation. I've seen a couple of efforts to use that tooling in Clojure/CLJS, and I think they mostly get abandoned. I think that the main reason is that the problem that the cdk is solving is providing an autocomplete system that wraps the inconsistent and confusing aws apis, and doesn't really have any state to update or much information processing to do. The cdk lifecycle means that the code runs, outputs a bunch of json files and then exits. In this case, having an type system guide you through the maze of aws apis provides way more benefit than the good things that Clojure/CLJS can give you (like a working equals implementation, or macros, or protocols, or any of the other great things you might want to use to develop the code you actually run in production). I think that it's always worth thinking about the context in which a tool is being used.

2
💡 2
👍 4
Karthikeyan A K14:06:09

Did a video about Porting single argument function to accept multiple arguments in Clojure https://www.youtube.com/watch?v=cE8oAyCjF_s

Muhammad Amin15:06:10

Hi everyone, an absolute cljs beginner here looking to develop websites using cljs. Are there any tutorial/courses where I can learn? Also are there any open source websites/ source codes which I can study to learn?

Ben Lieberman15:06:18

https://github.com/thheller/shadow-cljs shadow is a popular build tool for CLJS and the repo cites many example projects. Also check out the official Clojurescript site http://clojurescript.org! And the #clojurescript channel too for other resources

seancorfield15:06:58

I'd also add that there's a big difference between "develop websites" and "develop applications". What sort of sites are you looking to develop @U05B761VCAF? Something rich and interactive with most of the work on the client, or something that is mostly static with content stored in a database (like a blog)?

Muhammad Amin17:06:56

Thanks @U03QBKTVA0N, I'll look more into it. @U04V70XH6 I'm looking to develop more static websites, not overly interactive

seancorfield17:06:47

For mostly static sites, ClojureScript is probably overkill. Is there a server component to what you're thinking about? Content from a database etc?

Muhammad Amin18:06:23

just in the experimental stage right now. could switch later on but currently want to learn it to develop static sites

valerauko08:06:19

in that case you're probably better off either generating the html server-side with hiccup or using a static site generator (idk if there's one in clojure)

seancorfield18:06:37

https://cryogenweb.org/ is a nice static website generator that is written in Clojure.

Nundrum20:06:29

@U05B761VCAF You might want to check out HTMX as well. I had need for a very simple personal web "app" and used HTMX on the frontend with Clojure on the backend. Hiccup makes it easy to generate responses for HTMX.

jpalharini17:06:32

Ever wondered how to extend a Java interface in Clojure using :gen-class? See https://github.com/jpalharini/clj-logback-appender of a Logback Appender. 🙂

👍 4
🪵 2