diff options
author | metagn <metagngn@gmail.com> | 2024-08-12 16:33:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-12 15:33:26 +0200 |
commit | 0c890ff9a70258af8231967229b891df9731a5df (patch) | |
tree | f42d7dbf06e1f9441c704f3aebb288457f3ff0ea /changelog.md | |
parent | 7a0069a134aae949f310b5936c6a31270dc79316 (diff) | |
download | Nim-0c890ff9a70258af8231967229b891df9731a5df.tar.gz |
opensym as node kind + fixed experimental switch (#23892)
refs https://github.com/nim-lang/Nim/pull/23873#discussion_r1687995060, fixes #23386, fixes #23385, supersedes #23572 Turns the `nfOpenSym` node flag implemented in #23091 and extended in #23102 and #23873, into a node kind `nkOpenSym` that forms a unary node containing either `nkSym` or `nkOpenSymChoice`. Since this affects macros working on generic proc AST, the node kind is now only generated when the experimental switch `genericsOpenSym` is enabled, and a new node flag `nfDisabledOpenSym` is set to the `nkSym` or `nkOpenSymChoice` when the switch is not enabled so that we can give a warning. Now that the experimental switch has more reasonable semantics, we define `nimHasGenericsOpenSym2`.
Diffstat (limited to 'changelog.md')
-rw-r--r-- | changelog.md | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md index 75b848ebd..5056d7b3d 100644 --- a/changelog.md +++ b/changelog.md @@ -78,7 +78,9 @@ is often an easy workaround. - An experimental option `genericsOpenSym` has been added to allow captured symbols in generic routine bodies to be replaced by symbols injected locally by templates/macros at instantiation time. `bind` may be used to keep the - captured symbols over the injected ones regardless of enabling the option. + captured symbols over the injected ones regardless of enabling the option, + but other methods like renaming the captured symbols should be used instead + so that the code is not affected by context changes. Since this change may affect runtime behavior, the experimental switch `genericsOpenSym` needs to be enabled, and a warning is given in the case @@ -110,6 +112,13 @@ is often an easy workaround. assert baz[int]() == "captured" ``` + This option also generates a new node kind `nnkOpenSym` which contains + exactly 1 of either an `nnkSym` or an `nnkOpenSymChoice` node. In the future + this might be merged with a slightly modified `nnkOpenSymChoice` node but + macros that want to support the experimental feature should still handle + `nnkOpenSym`, as the node kind would simply not be generated as opposed to + being removed. + ## Compiler changes - `--nimcache` using a relative path as the argument in a config file is now relative to the config file instead of the current directory. |