vinum-team / Vinum

A modern reactive state management library for correctness and speed.
MIT License
16 stars 1 forks source link

Add namespaces to Groups #10

Closed sinlerdev closed 1 year ago

sinlerdev commented 1 year ago

Currently, tables that are passed to be tied to a key are tied as singular states, as opposed to tables creating a new namespace.

Namespaces are a very powerful feature to the centralized state paradigm, as sometimes, you have to divide multiple states into places according to their relevance- however, how can we explicitly define that a key is a namespace key rather than a normal one? As after all, there is nothing that helps developers know when a key is a namespace/normal one.

However, Namespaces can be also created by nesting groups, and treating each group as a new namespace, which can look something like this (this depends on #9):

local centerGroup = Group({
    Namespace1 = Group({
        key1 = "hi"
    }, AlwaysTrue)
}, AlwaysTrue)

The instead looks like a far more superior solution to me, as it avoids implementing a new feature that risks causing issues with code understandability, Plus, we can actually create a specific processor to each namespace!

sinlerdev commented 1 year ago

Just like previously mentioned, Namespaces can be created as groups which allows for setting a new processor for each namespace, Plus, it avoids designing a new API to allow for native namespaces.

This is rejected.