3 ms·
I wish an alternative to JS for the front end would catch on and be something more than obscure... I'd love to use something like clojurescript, but I struggle
by timwis 5mo ago
I wish an alternative to JS for the front end would catch on and be something more than obscure... I'd love to use something like clojurescript, but I struggle to imagine doing so for anything but a personal side project :/ Maybe this is easier to adopt if you're already a clojure shop for the backend?
- oDot 5mo agoYou should try Gleam. I'm using it in production to great delight: https://blisswriter.app/ https://blisswriter.app/ https://blog.nestful.app/p/how-we-dropped-vue-for-gleam-and https://blog.nestful.app/p/how-we-dropped-vue-for-gleam-and
- eliasson 5mo agoI agree! I have kept an eye on Elm for many years, I think the simplicity and architecture is great, but the language itself never clicked for me. Then I was made aware of Lustre[1], an Elm inspired web framework in Gleam. I have done two small projects in it now and I really enjoy working with both Lustre and Gleam. [1] https://github.com/lustre-labs/lustre https://github.com/lustre-labs/lustre
- jwr 5mo agoDon't be afraid, it's great! I certainly wouldn't call it "obscure", I've been using it for 10 years now to compile a complex app into highly-optimized client-side code. And the community is very welcoming and mature.
- ezst 5mo agohttps://www.scala-js.org/ https://www.scala-js.org/ is quite phenomenal.
- xmcqdpt2 5mo agoAfter reading https://hypermedia.systems/ https://hypermedia.systems/ I came to the conclusion that the best frontend is no frontend.
- drob518 5mo agoThis is the way. Sure, the line is gray, but the more you can do on the server, the better off you are, IMO.
- ecshafer 5mo agoBuilding UI in HTMX is such a breath of fresh air. I hope it kills the "React" style big complicated SPAs. Its so easy to develop in, its so fast to run, so fast to load.
- Smalltalker-80 5mo agoPerhaps SmallJS, a Smalltalk built on top of JS, that can run in browsers and in Node.js (and also has async-await :-) : https://small-js.org https://small-js.org
- gdotdesign 5mo agoCheck out Mint (https://mint-lang.com https://mint-lang.com), it's s language where everything is built in: small to mid size projects can be built without any third party dependencies and JS interop is easy.
- everforward 5mo agoAre you worried because it’s not a mainstream language and coworkers may not know it, or are you worried about the language itself getting abandoned or being bad or such? I’ve not used it in production, but I’ve shipped a few side projects and stuff for family members in it. ClojureScripts React wrapper, Reagent, honestly makes more sense to me than React does. I used Hiccup to generate HTML, and your components are just functions within Hiccups DSL (which is really just lists) and it ends up looking incredibly clean. Static things look static, dynamic things are obviously so, and it felt much less magic than regular React. The only things I found that felt bad were trying to use non-functional components I found on NPM. It’s not a deal breaker, but the code was ugly. Nothing I couldn’t fix with a wrapper, but some JS libraries are heinously ugly in cljs by default.
- kccqzy 5mo ago> Static things look static, dynamic things are obviously so, and it felt much less magic than regular React. Yes! The moment for me was when React introduced their notorious useEffect/useState hooks API. It immediately jumped out to me as the wrong API, by making static things dynamic. Reagent was really a breath of fresh air. Reagent was a really nice API, though it somewhat encouraged inefficient code.
- bcrosby95 5mo agoA big reason why react in clojure can make more sense than react itself is because clojure is much more declarative than JavaScript. There's been a lot of work done on the react end to fix that but the mismatch will always be there. The type of code you're writing isn't special, it's the way people have written lots of clojure programs for over a decade.
- everforward 5mo agoTotally agree. I also think Clojures relative lack of support for custom types leads to elegant APIs. It’s a breath of fresh air that practically every DSL takes either lists or maps so I can use very similar patterns to build their input rather than “every API wants me to method chain their custom types so every API needs its own special helpers library for common patterns”. I never realized how much I hate classes until Clojure. Have you tried typed Clojure? Curious about opinions on that vs having Malli do runtime validation. I tried it when I was a total noob and got overwhelmed. I feel like I have just enough context now to try again, and not sure if it’s nice or the overhead is so high it’s a boondoggle
- deleted 5mo ago[deleted]
- kccqzy 5mo agoTen years ago we were writing ClojureScript for the frontend at work. We weren’t a Clojure shop at all. As my then manager said, picking ClojureScript was part of the hiring bar: people who weren’t interested in functional programming tended not to be good programmers and so we avoided hiring these people.
- iLemming 5mo ago> I struggle to imagine doing so for anything but a personal side project Don't imagine. You have any bash scripts your team uses? Rewrite them in Babashka. Start with your own personal scripts first, get a knack for it, feel the benefits (it's not going to be universally better for every case). You have to be very confident about it personally, because people will come for your guidance later. This is a good strategy for introducing unfamiliar things - pick something less important, rewrite it, let it sit there. If it becomes problematic - easy to revert. If people start liking it, you can add more, and so on. That's how I sneaked F# in my .net shop years ago - I started writing less important tests in it.