summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2024-07-16 00:47:06 -0600
committerGitHub <noreply@github.com>2024-07-16 08:47:06 +0200
commitcd946084abdf3ab64b2540e2f29c1034ae1511e5 (patch)
treef7292a50e77e36a7ac3be2cb9b0737bd538a76e7 /doc
parent648f82c2edbf34c1a8d9df464fa0987accce3b03 (diff)
downloadNim-cd946084abdf3ab64b2540e2f29c1034ae1511e5.tar.gz
make routine implicitly gensym when other gensym symbol exists again (#23842)
fixes #23813, partially reverts #23392

Before #23392, if a `gensym` symbol was defined before a proc with the
same name in a template even with an `inject` annotation, the proc would
be `gensym`. After #23392 the proc was instead changed to be `inject` as
long as no `gensym` annotation was given. Now, to keep compatibility
with the old behavior, the behavior is changed back to infer the proc as
`gensym` when no `inject` annotation is given, however an explicit
`inject` annotation will still inject the proc. This is also documented
in the manual as the old behavior was undocumented and the new behavior
is slightly different.
Diffstat (limited to 'doc')
-rw-r--r--doc/manual.md9
1 files changed, 6 insertions, 3 deletions
diff --git a/doc/manual.md b/doc/manual.md
index 16c116328..e471658a4 100644
--- a/doc/manual.md
+++ b/doc/manual.md
@@ -6216,9 +6216,12 @@ scope is controlled by the `inject`:idx: and `gensym`:idx: pragmas:
 `gensym`'ed symbols are not exposed but `inject`'ed symbols are.
 
 The default for symbols of entity `type`, `var`, `let` and `const`
-is `gensym` and for `proc`, `iterator`, `converter`, `template`,
-`macro` is `inject`. However, if the name of the entity is passed as a
-template parameter, it is an `inject`'ed symbol:
+is `gensym`. For `proc`, `iterator`, `converter`, `template`,
+`macro`, the default is `inject`, but if a `gensym` symbol with the same name
+is defined in the same syntax-level scope, it will be `gensym` by default.
+This can be overriden by marking the routine as `inject`. 
+
+If the name of the entity is passed as a template parameter, it is an `inject`'ed symbol:
 
   ```nim
   template withFile(f, fn, mode: untyped, actions: untyped): untyped =