Skip to content

Commit 0634b9b

Browse files
committed
rename example module and parameters
1 parent b74886a commit 0634b9b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/codeql/ql-language-reference/modules.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,33 +142,33 @@ Parameterized modules are QL's approach to generic programming.
142142
Similar to explicit modules, parameterized modules are defined within other modules using the keywork ``module``.
143143
In addition to the module name, parameterized modules declare one or more parameters between the name and the module body.
144144

145-
For example, consider the module ``ApplyFooThenBar``, which takes two predicate parameters and defines a new predicate
145+
For example, consider the module ``M``, which takes two predicate parameters and defines a new predicate
146146
that applies them one after the other:
147147

148148
.. code-block:: ql
149149
150-
module ApplyFooThenBar<transformer/1 foo, transformer/1 bar> {
150+
module M<transformer/1 first, transformer/1 second> {
151151
bindingset[x]
152-
int apply(int x) {
153-
result = bar(foo(x))
152+
int applyBoth(int x) {
153+
result = second(first(x))
154154
}
155155
}
156156
157157
Parameterized modules cannot be directly referenced.
158158
Instead, you instantiate a parameterized module by passing arguments enclosed in angle brackets (``<`` and ``>``) to the module.
159159
Instantiated parameterized modules can be used as a :ref:`module expression <name-resolution>`, identical to explicit module references.
160160

161-
For example, we can instantiate ``ApplyFooThenBar`` with two identical arguments ``increment``, creating a module
161+
For example, we can instantiate ``M`` with two identical arguments ``increment``, creating a module
162162
containing a predicate that adds 2:
163163

164164
.. code-block:: ql
165165
166166
bindingset[result] bindingset[x]
167167
int increment(int x) { result = x + 1 }
168168
169-
module IncrementTwice = ApplyFooThenBar<increment/1, increment/1>;
169+
module IncrementTwice = M<increment/1, increment/1>;
170170
171-
select IncrementTwice::apply(40) // 42
171+
select IncrementTwice::applyBoth(40) // 42
172172
173173
The parameters of a parameterized module are (meta-)typed with :ref:`signatures <signatures>`.
174174

0 commit comments

Comments
 (0)