DEV Community

Discussion on: React: "I really wish this is how I could write components."

Collapse
 
vonheikemen profile image
Heiker

I, too, want pattern matching in javascript and i also want Maybes and Eithers.

Collapse
 
kayis profile image
K
Collapse
 
joelnet profile image
JavaScript Joel

Z looks interesting for sure. It's a little limited though. But it would work fine for this use case.

Collapse
 
joelnet profile image
JavaScript Joel

Same. You can use Maybes and Eithers today with a package import. The barrier is getting people familiar with them. Right now there's a lot of push back against them just because of familiarity bias.

If the language adopted them as native though, people would jump on board.

People are silly like that.

Collapse
 
vonheikemen profile image
Heiker

If the language adopted them as native though, people would jump on board.

I think so too. Rust has them, they are called Option and Result. I secretly want Rust to become more popular so people can learn about them and how useful they are, and also start using them in other languages (and by other i mean javascript)

Thread Thread
 
kenbellows profile image
Ken Bellows

Interestingly, Rust has started to become more popular in Web Land as a language for writing WASM modules, in part because of the strong support from the Rust team themselves. See developer.mozilla.org/en-US/docs/W...

Collapse
 
patroza profile image
Patrick Roza

I like this one dev.to/_gdelgado/type-safe-error-h...
Currently im working on trying to reduce all the friction that happens when a language doesn’t support it more natively, hopefully have a post up with samples in the next month or so :)