Closed moajo closed 7 years ago
If the plugin does not follow the naming rules, there is a problem that the namespace is not unique.
I suggest to namespaces to be UPPERCASE. Because it is necessary to unify letters case lower or upper to prevent typing errors, but UPPERCASE letters are more looks like NAMESPACE than lowercase.
The namespace was decided to be lowercase so as to be the same as the package name. By the way, NSIdentity is not currently used for attributes name.we need to fix this problem. In order to comprehensively solve these problems with the specification change of the namespace, I propose the namespace specification as follows.
In order to adopt this form, we restrict only available letters to package,node and other names to lowercase letters , numbers and '-'.
This is another idea for namespace feature of Grimoire. I want to have nesting of namespaces in Grimoire.js.
Some shaders can have same name of variables when the material file use multiple techniques.
@Technique default{
uniform float hello;
}
@Technique depth{
uniform float hello;
}
Shader engineers need to consider what shader techniques can be used the other technqiue in render stage. So, I want to have nesting attribute namespace.
Assume the shader above was declared in grimoirejs-awesome-shader
. Then hello attribute should have grimoirejs-awesome-shader
. I would like to use namespace grimoirejs-awesome-shader.depth
for second technique declared in the material file to register in attribute variable in Grimoire.js fundamental.
If attribute hello
was specified by user without namespace notation, we will use grimoirejs-awesome-shader
because it is defined in grimoirejs-awesome-shader.
grimoirejs-fundamental` can decide namespace respectively.
But If attribute hello
can have a namespace depth
as namespace notation, we can use them for specifying depth technique.
If there was no depth
attribute with grimoirejs-awesome-shader
but there was depth
attribute with grimoirejs-awesome-shader.depth
, Grimoire will use grimoirejs-awesome-shader.depth
for this case even if there was another hello attribute with grimoirejs-the-other-namespace
namespace.
Generally, you do not need to limit the depth of namespace hierarchy. When specifying an object, you can omit the left side of any dot with FQN. In this case, ambiguity can be resolved according to the situation.
How to consider situation? I think these situations are the most important part of this specifications.
Motivation
Basic namespace rule of XML is redundant for Grimoire.js. Each packages are basically managed by npm. (Even the package was not uploaded on npm, the package would be containing package.json if that was build with Node.js)
Therefore, each namespaces of grimoire plugins should be generated from package.json as the specification below.
Specification
Each components, nodes and converters should use the namespace determined by package.json. In the package named
grimoirejs-fundamental
, each these contents usefundamental
as namespace.grimoirejs
package (this package) will usegrimoirejs
as a namespace. (This is the only exception of the rule above)