ds300 / derivablejs

Functional Reactive State for JavaScript and TypeScript
Apache License 2.0
515 stars 23 forks source link

[WIP][Breaking changes] Reducing complexity #89

Closed TrySound closed 6 years ago

TrySound commented 6 years ago

I have a few proposals and questions

Questions

P.S. After this PR+discussion I'm going to rewrite API docs.

/cc @ds300 @andreypopp @friedbizkvit

andreypopp commented 6 years ago

I think it's a good idea in general. I'm all for reducing the API surface, especially removing overloads from methods and making them more "typeable". It would be cool to see how is API going to look like in terms of typings.

TrySound commented 6 years ago

Also should we introduce deprecations for the next release?

ds300 commented 6 years ago

Sure go ahead. These seem like good changes.

Should we support derivable arguments?

Maybe not. That's a bit too black-magic-like for my tastes these days.

Do we even need complex and unreadable switch method combinator since it's not that hard to write own derivation?

No. Get rid of it.

Can we replace mOr with something static/fantasy land type like alt?

Sure

Do we need both named and default exports in entry point? I guess named exports can be resolved everywhere.

Nope. Go for only named.

Can we rename .derive and .mDerive methods to map and maybe mMap to separate behavior from derive function and remove explicit injections (are they some political decisions?)

Hmm this I'm not sure about. I definitely prefer the word derive to to the word map which has all kinds of other connotations, even in the JS ecosystem. Injections can be removed though. I think I was the only person who really used that.

:+1:

TrySound commented 6 years ago

Okay. The next series

ds300 commented 6 years ago

Do we need template, match (pretty simple), prop (hard to type, with map easy to type)

I guess not.

Do we need functional map, mMap, match, prop versions

Nope.

Do we really need then, mThen instead of simple ternary?

Nope.

Should we deprecate all stuff before removing or burn it all?

Burn it

I found mOr, mAnd, and, or typed with boolean output. This case isn't so useful. mOr can be renamed to alt. How can be others useful? Maybe remove?)

Sure, remove everything but alt.

Same question for not.

Remove that too.

Love what you're doing here. I added all this complexity because I wanted DerivableJS to be a DSL-like tool, but everyone else who used it just wanted the reactivity and didn't care about the DSL stuff. Now that I'm older and more experienced I see the value in keeping as much logic in the host language's primitive syntax forms as possible. Can't wait to try using DerivableJS again after you're done!