Skip to content

Commit d92af15

Browse files
committed
docs(api-and-naming): elaborate on double underscores as scope markers
#539 (comment)
1 parent ed168f0 commit d92af15

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

doc/api-and-naming.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ the box. But there are some, see [configuration](configuration.md).
3030

3131
Variables and functions whose name contains a double underscore (`__`) anywhere
3232
in their name are private implementation details, not part of the stable API,
33-
and not intended to be used outside of their defining context.
33+
and not intended to be used outside of their defining context. Internally, the
34+
double underscores serve as privacy scope markers; there can be more than one
35+
pair of them in a name, and functions and variables are intended to reference
36+
and call other functions and variables within that scope, one level deep,
37+
sharing a common prefix. For example, a function named `_comp_foo` is allowed
38+
to access `_comp_foo__*` where `*` does not contain any double underscores,
39+
i.e. it should not access `_comp_foo__something__*` despite the common prefix.
3440

3541
Functions with names prefixed with `_comp_xfunc_` are intended to be used
3642
through the `_comp_xfunc` function from files other than the one they are

0 commit comments

Comments
 (0)