Description
the export_state macro does two things:
- creates a state variables that is shared by all instances of the component class.
- makes the state variable publicly accessible (outside the class) so you can say
Foo.state
andFoo.state!
anywhere.
I think we deprecate this, and change it to something like this:
state :state_name, access: :read/:update { optional initializer block }
so you would say
state :foo access: :update { [] }
to create a state called foo
that was shared by all components of the class, and could be read and written externally as ClassName.foo/foo! (and that is initialized to the empty array)
The reason we need to do this is this in many instances you DONT want to export the state or if you do, you only want to export the getter.
Looking for any comments, and in particular suggestions on the syntax.
state
by itself is good because its short, but probably confusing but it does not emphasize the "class level" nature.
static
is great but ain't ruby.
class_state
or shared_state
might be the way to go?