GrimoireGL / GrimoireJS

A WebGL framework for Web development.
https://grimoire.gl
MIT License
350 stars 24 forks source link

Change specification for namespace #478

Closed moajo closed 7 years ago

moajo commented 7 years ago

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 use fundamental as namespace.

grimoirejs package (this package) will use grimoirejs as a namespace. (This is the only exception of the rule above)

moajo commented 7 years ago

If the plugin does not follow the naming rules, there is a problem that the namespace is not unique.

moajo commented 7 years ago

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.

moajo commented 7 years ago

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 '-'.

kyasbal commented 7 years ago

This is another idea for namespace feature of Grimoire. I want to have nesting of namespaces in Grimoire.js.

Motivation

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.

Suggestion

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.

moajo commented 7 years ago

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.

kyasbal commented 7 years ago

How to consider situation? I think these situations are the most important part of this specifications.