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
Global scope must be used with caution, because dataflow is not explicit. As soon as we use global scope, we must guarantee dataflow ourself, without relying on compiler.
For example, if we swap order of set_name and print_name in Main component, we will get runtime error.
This example however is too simple to express the danger of this style. In other words, without it, compiler can guarantee that message X is available, when we reffer to it. This API changes this.
To visualize it better we need to imagine a deep hierarhy of components where betwen parent that sets or reads the value, and other side of this "channel" is a tree of several levels. Components can talk this way in any structure, any order.
UPD this proposal has same problem as context API from #812
Any message we get from global scope is any and we need to be able to assert a specific type at runtime. More than that, it must play nice with pattern matching
The text was updated successfully, but these errors were encountered:
The idea is implement API that will allow components to share data without exlicit message passing
global
package implements Key-Value storage interface that might be visualized this wayGlobal scope must be used with caution, because dataflow is not explicit. As soon as we use global scope, we must guarantee dataflow ourself, without relying on compiler.
For example, if we swap order of
set_name
andprint_name
inMain
component, we will get runtime error.This example however is too simple to express the danger of this style. In other words, without it, compiler can guarantee that message X is available, when we reffer to it. This API changes this.
To visualize it better we need to imagine a deep hierarhy of components where betwen parent that sets or reads the value, and other side of this "channel" is a tree of several levels. Components can talk this way in any structure, any order.
UPD this proposal has same problem as context API from #812
Any message we get from global scope is
any
and we need to be able to assert a specific type at runtime. More than that, it must play nice with pattern matchingThe text was updated successfully, but these errors were encountered: