Never seen anyone who claims they develop Typescript apps functional style. https://lambda.hothire.dev/profile/pantagruel74 Wondering how many of you use purely use functional style to develop code even if your language is OOP?
Not pure but I try When I write Python it's mostly immutable data classes, interfaces and functions. I rarely reach for a regular old class. Heck, I even ported the component framework to python to abstract some messy OO and mutability away
We try as much as possible in our ts codebase. The newer functional code is an order of magnitude easier to reason about.
I mostly did functional Js and Ts before changing to Clojure. One constant grief was that same team always had OOP and functional people.
Agree with the others: I try as much as possible, but when mutable data structures are a core part of the language, some mutations inevitably slip through the cracks.
I'll reiterate what other said: immutability, idempotence and pure functions can be used in all languages. BTW, TS is not an OOP language, even though lots of people use it as if it is.
One could argue TS is not a language at all
One could argue that a thing that has a compiler is a language?
I'm just adopting the cheeky position TS is a linter not a language. Curiously the type system is a language ๐
Fair ๐
I worked for a startup that went all-in in functional javascript, as in probably not a single let in the codebase, and using RamdaJS for everything. https://ramdajs.com/docs
Our 150K lines of JS at work is fairly functional in style so it isn't too horribly foreign for me when I need to work on the front end instead of our 150K lines of Clojure on the backend. We were lucky that the front end team we hired, years ago, preferred the functional style and immutable data where appropriate.
This is the way. And in TS you can actually enforce that via the readonly access modifier in interface member definitions, as well as the Readonly utility type. Unfortunately, this isn't automatic and has to rely on a heavy use of conventions and lint rules.
Not TS, but I like using immutable-js in javascript to be more like Clojure, but I find that I use fromJS and toJS a lot with no method to that madness
Ugh, Immutable.js is so nasty to use. Have you considered immer as a (partial) replacement?
Given how much code we have (and how few resources we have to maintain it), no ๐
Ugh, Immutable.js is so nasty to use. Have you considered immer as a (partial) replacement?didn't know about it. I'll check into itAt work our frontend is in React/TypeScript and I don't think we have a single JS class across the entire app.
As others have mentioned I have never thought of JS/TS as an OO language. Eloquent JavaScript was one of the first programming books I ever read, and introduced me to the concept of higher-order functions before I had even heard of functional programming. That was back before JS class syntax was widely supported. :)
๐ https://github.com/chaploud/ClojureWasmBeta
Thanks for your interest in ClojureWasmBeta ๐ An official English version of ClojureWasm has recently been published. Itโs currently in a pre-alpha stage. If youโre interested, feel free to take a look. Iโm not very active on Slack, so responses there might be slow. https://github.com/clojurewasm/ClojureWasm
Whoah! Is this kinda like Jank but for Zig?
yeah I don't know, I don't speak Japanese. Does it offer Zig / C interop?
i don't see any mention of c interop. just an explicit policy of not doing jvm interop.
I used google translate: https://github-com.translate.goog/chaploud/ClojureWasmBeta?_x_tr_sl=auto&_x_tr_tl=en
there is quite a bit of detail in the docs and plan directories
looks like there might have been a presentation within the last day
looks like this might have been the presentation material: https://github.com/chaploud/ClojureWasmBeta/tree/main/docs/presentation
that's how I discovered this, via a mention of the word babashka on social media
(or she, etc)
Looks like the interop(integration?) is to wasm: https://github-com.translate.goog/chaploud/ClojureWasmBeta/blob/main/docs/presentation/index_15min.md?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp#demo-4-wasm-%E9%80%A3%E6%90%BA-%E5%9F%BA%E6%9C%AC--%E3%83%9B%E3%82%B9%E3%83%88%E9%96%A2%E6%95%B0
lol -- somehow that link doesn't work where i am but i do see the equivalent of "wasminterop yes" in the babashka comparison table
a bit further down there is a section which attempts to describe what is meant by "wasminterop": https://github.com/chaploud/ClojureWasmBeta/blob/main/docs/presentation/qa_cheatsheet.md#wasminterop-%E3%81%A3%E3%81%A6%E4%BD%95
Oh yeah, my last link fails now for me too. Here's some wasm integration code: https://github.com/chaploud/ClojureWasmBeta/blob/main/docs/presentation/index_15min.md#demo-4-wasm-%E9%80%A3%E6%90%BA-%E5%9F%BA%E6%9C%AC--%E3%83%9B%E3%82%B9%E3%83%88%E9%96%A2%E6%95%B0
will probably take a look more later. gotta hit the sack ๐ take care!
Google translated nice things about Babashka (from https://github-com.translate.goog/chaploud/ClojureWasmBeta/blob/main/docs/presentation/qa_cheatsheet.md?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp) > Wouldn't Babashka be okay? > โข Babashka is a great tool and there is some overlap in usage. > โข Differentiation: WasmInterop and extremely lightweight (2MB memory) > โข Not a competitor, but a niche: Babashka is strong in situations where you want to use Java library assets
> This repository is intended for experimental and research use. A more formal project with complete English documentation will be published separately in the future. via: https://github.com/chaploud/ClojureWasmBeta/commit/d3c15ac40d106efd0bb33ea83c242105d160c73c