> home > Custom Layer Boundary API


January 19th 2020
Get a scope that has a lifetime dependent on all of the dependent scopes and is unique up to set isomorphisms of the 'hard' dependencies


get_managed_scope_with_multiple_dependencies(Application_Links* app,
                                             Managed_Scope* scopes,
                                             i32 count);



the standard custom layer context pointer


a pointer at the base of an array of scope ids specifying the set of dependencies to use in querying or constructing the resulting scope


the number of scope ids in the scopes array


the scope id of the scope with multiple dependencies on success, when all the scopes in input array exist, zero otherwise


The behavior of this call can be confusing so here are some rules of thumb for how it works, assuming all input scopes are valid:
1. When there is only one scope in the parameters, that scope is the result. {A} -> A;
2. When there are two or more parameters that are the same scope, the result is that scope again. {A, A, ..., A} -> A;
3. When any scope in the parameters is the special global scope, it is as if it is not there. {A, G} -> A
4. When two scopes are constructed from the same set of parameters, they are the same, regardless of parameter order. {A, B} -> C; {B, A} -> C;
5. When any of the scopes in the parameters was itself returned by this call, it is as if the parameters from it's constructor are substituted for it. {A, B} -> C; {C, D} -> E; {A, B, D} -> E;
6. When the parameter set is empty the result is the global scope. {} -> G
For a set-theoretic definition one can think of scopes as being keyed by sets of 'atoms'. Getting the key for a scope with multiple dependencies is defined by the operation of union of sets. The global scope is keyed by the empty set. A scope continues to exist for as long all of the atoms in it's key set exist.