Hacker News new | ask | show | jobs
by slifin 2125 days ago
ClojureScript has some oddities compared to Clojure but in my experience acts much nicer than plain JS

Clj-kondo is good to detect unintended passing, in terms of correctness there are sometimes minor fixes but not at the expense of backwards compatibility which is taken very seriously in core

In terms of doing idiomatic Clojure in Typescript, "good" Clojure is data driven Typescript is type driven

Universal data primitives Vs label everything with types aren't terribly compatible

1 comments

> ClojureScript has some oddities compared to Clojure but in my experience acts much nicer than plain JS

For the most part I agree with this, but... it's not saying much.

> In terms of doing idiomatic Clojure in Typescript, "good" Clojure is data driven Typescript is type driven > > Universal data primitives Vs label everything with types aren't terribly compatible

Huh? What I said is that I try to apply the principles I learnt in Clojure—yes, including writing code that is data-driven, and more importantly value driven—in the most idiomatic way I can within TypeScript. Yes, the whole point of TypeScript is types (it's in the dang name), but:

1. Types describe data. The only major difference between the kind of data described in TypeScript and the kind of data implicitly defined in Clojure is that TypeScript inherited a runtime where mutability is the default and immutability is more a choice of convention than an actual feature of the language.

2. The TypeScript type system is extremely good at describing and statically validating the kind of dynamic polymorphism common in Clojure.

3. Even if it isn't, small and specific interfaces could be used as contracts to achieve roughly the same thing, just with more keyboarding.