Hacker News new | ask | show | jobs
by substation13 1311 days ago
> My only hope is for ECMAScript (or maybe TypeScript) to introduce these OK/Err/Maybe/Task concepts as a language feature

When using these concepts the need for do-notation comes up pretty quickly. It would be like using JS promises without the async keyword!

Of course, follow this to it's conclusion and you will have a functional language.

1 comments

I mean they could ADD it, just like nowadays individuals can choose to implement it themselves, but it wouldn't supersede any existing error / result implementations (success/error callbacks, throw/catch, promises which use both, etc).

To improve or change a language, I think you should get rid of another feature if it solves the same problem, instead of add another option.

> just like nowadays individuals can choose to implement it themselves

I don't think this is possible with JS right now?