constant a = 0
+module M {
+ constant a = 1
+ constant b = a # a refers to M.a here; b = 1
+ constant c = .a # a refers to a here; c = 0
+}
+From e5c8ff50d8d0f917e8aa925a876463c11fabbb12 Mon Sep 17 00:00:00 2001
From: Rob Bocchino Optionally, you can write a qualified name with a leading dot.
+This form says to compute the name starting at the top, instead
+of starting at the current level.
+For example: As shown in the example, the leading-dot form is useful when
+a definition is hidden or shadowed by another definition
+with the same unqualified name in an inner scope.
+In the example above, inside module As with namespaces in C++, you can close a module definition and
reopen it later.
All the definitions enclosed by the same name go in the module
@@ -13779,6 +13803,20 @@ You can also write a location specifier using the leading
+dot syntax, like this: In this case, the name Notice that the tool uses the leading dot
+form of the definition name.
+That is because the names are always specified from the top level.
+The leading dot ensures that the name will have the same meaning
+regardless of where the location specifier appears in the model.5. Defining Modules
+constant a = 0
+module M {
+ constant a = 1
+ constant b = a # a refers to M.a here; b = 1
+ constant c = .a # a refers to a here; c = 0
+}M, the name a
+refers to M.a, so to refer to the constant a defined at the top
+level, we have to write .a.16.4.3.
which occurs before the analyzer has complete information about
definitions and their uses.
+module M { locate constant .a at "M.fpp" }.a is resolve to a, not M.a.
+The leading dot says to start the resolution at the top level,
+regardless of where the location specifier appears in the model.16.4.4. Included Files
@@ -13903,8 +13941,15 @@
+locate constant a at "Constants/a.fpp"
+locate constant .a at "Constants/a.fpp"16.5.2.
+locate constant a at "a.fpp"locate constant .a at "a.fpp"18.4. S
diff --git a/docs/users-guide/Defining-Modules.adoc b/docs/users-guide/Defining-Modules.adoc
index 0560b71ca..f47794a65 100644
--- a/docs/users-guide/Defining-Modules.adoc
+++ b/docs/users-guide/Defining-Modules.adoc
@@ -41,6 +41,28 @@ constant a = M.a
constant c = b # Error: b is not in scope here
--------
+Optionally, you can write a qualified name with a leading dot.
+This form says to compute the name starting at the top, instead
+of starting at the current level.
+For example:
+
+[source,fpp]
+----
+constant a = 0
+module M {
+ constant a = 1
+ constant b = a # a refers to M.a here; b = 1
+ constant c = .a # a refers to a here; c = 0
+}
+----
+
+As shown in the example, the leading-dot form is useful when
+a definition is hidden or *shadowed* by another definition
+with the same unqualified name in an inner scope.
+In the example above, inside module `M`, the name `a`
+refers to `M.a`, so to refer to the constant `a` defined at the top
+level, we have to write `.a`.
+
As with namespaces in {cpp}, you can close a module definition and
reopen it later.
All the definitions enclosed by the same name go in the module
diff --git a/docs/users-guide/Specifying-Models-as-Files.adoc b/docs/users-guide/Specifying-Models-as-Files.adoc
index 584682d7b..cc699dff4 100644
--- a/docs/users-guide/Specifying-Models-as-Files.adoc
+++ b/docs/users-guide/Specifying-Models-as-Files.adoc
@@ -431,6 +431,18 @@ The purpose of this rule is to facilitate dependency analysis,
which occurs before the analyzer has complete information about
definitions and their uses.
+You can also write a location specifier using the <
25.4. Translation Tools
diff --git a/docs/fpp-users-guide.html b/docs/fpp-users-guide.html
index 94d12f735..9e86df0f4 100644
--- a/docs/fpp-users-guide.html
+++ b/docs/fpp-users-guide.html
@@ -2100,7 +2100,8 @@ 5. Defining Modules
encloses.
To write the qualified name, you write the qualifier, a dot, and the base name:
for example M.a. (This is also the way that
-name qualification works in Python, Java, and Scala.)
+name qualification works in Python, Java, and Scala.
+The C++ equivalent is M::a.)
Inside the module, you can use the qualified name or the unqualified
name.
Outside the module, you must use the qualified name.
@@ -2140,7 +2141,8 @@ 5. Defining Modules
with the same unqualified name in an inner scope.
In the example above, inside module M, the name a
refers to M.a, so to refer to the constant a defined at the top
-level, we have to write .a.
.a.
+(The C++ equivalent is ::a.)
As with namespaces in C++, you can close a module definition and @@ -18569,7 +18571,7 @@