You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Architecture section of the docs, a simple example program is constructed using lager::with_manual_event_loop.
I'm confused because the update function that is created in that example (and in the std version of the counter program in /examples), does not seem to be used anywhere. The simple manual event loop which takes character inputs from stdin, creates an action using the intent function and dispatches an action in the store, but how would the store to know that it should run the actions through the update function?
I suspect that the stdin-based event loop should call the update and set its state using the new state, but I might just be missing something?
Thanks!
EDIT: When looking at 3a9733c I realized it was a namespace issue; it worked after I put the update function into the same namespace as the model.
I'm a C++ rookie, so this might be something obvious, but it had me very confused, so might be worth documenting :)
The text was updated successfully, but these errors were encountered:
Cool, thanks! You are right, this should be part of the documentation. This was a recent API change and did not fully integrate this in the documentation.
In C++ there is this rule called "ADL", which means that a function that is part of the same namespace of a type, it is part of the interface of that type, and you can use it without explicitly writing the namespace when you pass it arguments form that namespace. Note that you can also explictly pass with_reducer(...) to explitly pass a reducer, but by default, update(model, action) will be used by convention, which makes sense in most cases.
Thanks for reporting the issue. I'll leave this open as a reminder to add clearer documentation on this!
In the Architecture section of the docs, a simple example program is constructed using
lager::with_manual_event_loop
.I'm confused because the
update
function that is created in that example (and in thestd
version of the counter program in /examples), does not seem to be used anywhere. The simple manual event loop which takes character inputs from stdin, creates an action using theintent
function and dispatches an action in the store, but how would the store to know that it should run the actions through theupdate
function?I suspect that the stdin-based event loop should call the update and set its state using the new state, but I might just be missing something?
Thanks!
EDIT: When looking at 3a9733c I realized it was a namespace issue; it worked after I put the update function into the same namespace as the model.
I'm a C++ rookie, so this might be something obvious, but it had me very confused, so might be worth documenting :)
The text was updated successfully, but these errors were encountered: