ruby-hyperloop / hyper-react

The project has moved to Hyperstack!!
https://hyperstack.org/
MIT License
285 stars 14 forks source link

consistency between HyperOperation and HyperStore #209

Closed catmando closed 6 years ago

catmando commented 7 years ago

HyperOperation uses param syntax, and HyperStore uses states, but with improved syntax.

The new syntax should be available in HyperReact.

Its a little TBD right now but there draft readme s posted:

https://github.com/ruby-hyperloop/ruby-hyperloop.io/wiki/HyperStore-README https://github.com/ruby-hyperloop/ruby-hyperloop.io/wiki/HyperOperation-Readme

summary:

params will have more powerful checking of incoming params which we are stealing from the mutation gem.

states have (hopefully) a cleaner syntax for mutating and declaring.

state.item works like today mutate.item replaces state.item!

state declaration will remain optional (we feel that is most consistent with ruby behavior)

but you may declare state, and also initialize like this:

state_reader foo: 'i start being a string', scope: :class, as: :hoho

initializes foo to the string, creates foo at the class level, and creates an external class reader named hoho

everything is optional except the name.

state_reader :bar

initializes bar to nil, bar is an instance variable, and has an instance reader named bar.

private_state works the same except you don't get the reader method.

Hopefully there should be modules that we can shove around and reuse to integrate with HyperReact.

Please chat at above location if anything needs to change

catmando commented 6 years ago

I believe this was closed