5 ms·
Yes, yes and yes. All of these concepts are variations of what has been done before in a number of ways. Mostly by "FP academics" who "live in fantasy land", un
by antris 5y ago
Yes, yes and yes. All of these concepts are variations of what has been done before in a number of ways. Mostly by "FP academics" who "live in fantasy land", until everyone else starts using them too.
Transpiling, hooks and components have all been done (and done better) before React came along, but often they were laughed out as esoteric toys that have nothing to with "real programming". It's just hard to teach these concepts until you actually use them, and it's hard to get people to use these concepts unless they are included in something else that you need.
The same happened early with React, both JSX and VDOM were laughed at by many developers because "they looked stupid" to people who didn't understand them and were used to one way of doing things. MVC+jQuery+templates was the flavour of the day.
Same thing with TypeScript, FRP and so on.
Most likely, whatever concept is gaining momentum today, it's an exact or approximate copy, or in rare cases a novel remix of what has been researched 10-20 years ago, and used in production for 5 years before you heard about it on HN
These people who like to apply category theory etc. in programming have heard this mocking of their work as stupid esoteric fantasy (and then seeing them become mainstream later) so often that they literally called one of their specs "Fantasy Land" https://github.com/fantasyland/fantasy-land https://github.com/fantasyland/fantasy-land
There's still lot of work to be done. JavaScript doesn't even have proper immutable data structures natively, which would be a REAL low hanging fruit.
- eurasiantiger 5y agoThe esotericity is not in the expressible semantics, but in the syntax.
- ZephyrBlu 5y agoI'm very curious what the better, academic version of VDOM, hooks and components that has already been done looks like in comparison to React.
- antris 5y agoSvelte does reactive UI without a VDOM at all. Every DOM operation flows from declarative instructions based on the state of the application, without a need for VDOM or hooks. The compiler is quite mature and used by countless apps in production right now. https://svelte.dev/ https://svelte.dev/ I've been using it myself and it doesn't feel academic at all. The Svelte Kit toolkit, a successor to the Sapper frameworks is also ready to use but it's not 1.0 yet so might be a bit unstable. But if you're worried about having to figure things out then you can use Sapper+Svelte or just Svelte just fine, and they're very robust and well documented.
- ZephyrBlu 5y agoI know what Svelte is. Svelte wasn't done before React or by "FP academics" though, which is what you said in the comment I replied to.
- antris 5y agoAs I said, the VDOM was novel. However, unidirectional data flow, lenses and FRP with RxJs all predate React. There was also Elm which was a full framework that was based on these concepts, and ClojureScript with its whole ecosystem that did things a bit differently. Though most people who do utilise functional programming concepts prefer not to use a framework but pick-and-choose libraries that do the job for that specific project. That means that the field was (and is) very scattered, and there's no single "React but better and made earlier". Because React is a unique combination of tools. But each of those tools have been done in one form or another many times, except for the VDOM, which I believe was novel. On another note, a React component in FP is just any regular old JS function with a signature: `(state) => HTML string`. React is such a simple concept that it wouldn't have needed any sort of library, if it weren't for the performance and DOM reset issues.
- dmitriid 5y ago> However, unidirectional data flow, lenses and FRP with RxJs all predate React. They may predate React, but React made them easy. Good luck explaining how lenses work. Rx? it took the author of RxJava months to understand the concept. And he had the author of Rx.net there to explain stuff to him. [1] > there's no single "React but better and made earlier". Yes. And that is precisely the point [1] https://twitter.com/dmitriid/status/811561007504093184 https://twitter.com/dmitriid/status/811561007504093184
- antris 5y agoWell that's why said > React made a huge impact on web dev and deservingly so The VDOM was revolutionary, no question about it. The comment I was replying to didn't even mention it.