Description
Intro
In general a trend/principle in syntax definitions can be found which ends up with scoping the declaration/definition of constructs with entity.name.<construct>
. When calling/using such constructs, something like variable.<construct>
or variable.other.<construct>
is used.
The most popular example is entity.name.function
vs. variable.function
.
The goal is clear - distinguish definition and usage of the same object.
Question
How are namespaces
or modules
to handle in that manner?
A couple of syntaxes including C, C++, Python, PHP, Java, JavaScript, Erlang, ... support such concepts. Most of them use entity.name.namespace
to scope the identifier in the definition/declaration statement as the ST3 documentation at https://www.sublimetext.com/docs/3/scope_naming.html says:
Namespaces, packages and modules use the following scope. There are usually not multiple types of such constructs in a language, so this scope should suffice.
entity.name.namespace
But I can't find a common solution how to scope a namespace/module upon usage.
module_name:function_name()
- C# distinguishes between
support.namespace.cs
andvariable.other.namespace.cs
- CSS uses
entity.other.namespace-prefix.css
orentity.name.namespace.wildcard.css
- Erlang uses
entity.name.type.class.module.erlang
- Python just scopes them as
meta.generic-name
upon usage ormeta.import-name
in import statements. - ...
Can we find a common scope for that usage?
-
From my point of view anything starting with
entity.
is a no-go when we talk about usage. -
The most pleasant approach with respect of existing scoping guidelines and implementations seems to be
variable.other.namespace
. So we'd end up inentity.name.namespace
vs.variable.other.namespace
-
To keep up with the concept of function declaration and usage, I also could imagine to use
variable.namespace
. So we'd end up inentity.name.namespace
vs.variable.namespace
Thoughts?