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
from here on, foo1 is effectively a useless reference.
implications
If by any circumstances two different "space owners" chose the same name, the first of them to create his store is prompted to lose data, and the second may find there data he does not expect.
This is a behavior that would be very taunting to detect on dev-time.
My take on this
I suspect that in order to allow this behavior be discovered in development-time - we should do one of the following:
1. Assure namespaces never collide
throw an error when trying to create a space for a name in use.
This will assure that namespaces never collide. Packages use cls.get and only the context file (the one ran with node) does cls.create.
We may consider supporting symbols as namespace identifiers. Using namespaces across packages will require them all a reference to the same symbol - however, that's something that is done deliberately and intentionally - so it's like developer taking responsibility.
2. Create rules namespaces can be shared safely
createNamespace(name) and getNamespace(name) should do the same: if the space is there - it's returned, if not - it's created.
namespace.set(k,v) should return a value that indicates if a value is overwritten or not.
OR
use namespace.const(k,v) - throws when set a second time.
namespace.const(k,v,true) - the developer takes responsibility on replacing a constant)
OR BOTH 1+2 AND 3+4
Thoughts?
The text was updated successfully, but these errors were encountered:
Perhaps I do not understand the full intent of the module, but here is MHO.
I observed an error prone behavior:
from here on,
foo1
is effectively a useless reference.implications
If by any circumstances two different "space owners" chose the same name, the first of them to create his store is prompted to lose data, and the second may find there data he does not expect.
This is a behavior that would be very taunting to detect on dev-time.
My take on this
I suspect that in order to allow this behavior be discovered in development-time - we should do one of the following:
1. Assure namespaces never collide
throw an error when trying to create a space for a name in use.
This will assure that namespaces never collide. Packages use
cls.get
and only the context file (the one ran with node) doescls.create
.We may consider supporting symbols as namespace identifiers. Using namespaces across packages will require them all a reference to the same symbol - however, that's something that is done deliberately and intentionally - so it's like developer taking responsibility.
2. Create rules namespaces can be shared safely
createNamespace(name)
andgetNamespace(name)
should do the same: if the space is there - it's returned, if not - it's created.namespace.set(k,v)
should return a value that indicates if a value is overwritten or not.use
namespace.const(k,v)
- throws when set a second time.namespace.const(k,v,true)
- the developer takes responsibility on replacing a constant)OR BOTH 1+2 AND 3+4
Thoughts?
The text was updated successfully, but these errors were encountered: