diff options
author | metagn <metagngn@gmail.com> | 2022-12-13 23:20:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-13 21:20:55 +0100 |
commit | 9a50033d5b09ec3263a53bd2bb4182a8a50e6f4d (patch) | |
tree | 20810da72f31c577f858446c669afad45058abaa /changelog.md | |
parent | 2564b5c938602e4f8820d2ed2b778c6d4f1d0cd5 (diff) | |
download | Nim-9a50033d5b09ec3263a53bd2bb4182a8a50e6f4d.tar.gz |
generic `define` pragma + string alias (#20979)
* generic `define` pragma + string alias * clean * add tests and document * remove char/float, minimize changelog
Diffstat (limited to 'changelog.md')
-rw-r--r-- | changelog.md | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/changelog.md b/changelog.md index 5762d18ad..0181d03d2 100644 --- a/changelog.md +++ b/changelog.md @@ -221,9 +221,33 @@ - Full command syntax and block arguments i.e. `foo a, b: c` are now allowed for the right-hand side of type definitions in type sections. Previously they would error with "invalid indentation". -- `defined` now accepts identifiers separated by dots, i.e. `defined(a.b.c)`. - In the command line, this is defined as `-d:a.b.c`. Older versions can - use accents as in ``defined(`a.b.c`)`` to access such defines. + +- Compile-time define changes: + - `defined` now accepts identifiers separated by dots, i.e. `defined(a.b.c)`. + In the command line, this is defined as `-d:a.b.c`. Older versions can + use accents as in ``defined(`a.b.c`)`` to access such defines. + - [Define pragmas for constants](https://nim-lang.github.io/Nim/manual.html#implementation-specific-pragmas-compileminustime-define-pragmas) + now support a string argument for qualified define names. + + ```nim + # -d:package.FooBar=42 + const FooBar {.intdefine: "package.FooBar".}: int = 5 + echo FooBar # 42 + ``` + + This was added to help disambiguate similar define names for different packages. + In older versions, this could only be achieved with something like the following: + + ```nim + const FooBar = block: + const `package.FooBar` {.intdefine.}: int = 5 + `package.FooBar` + ``` + - A generic `define` pragma for constants has been added that interprets + the value of the define based on the type of the constant value. + See the [experimental manual](https://nim-lang.github.io/Nim/manual_experimental.html#generic-define-pragma) + for a list of supported types. + - [Macro pragmas](https://nim-lang.github.io/Nim/manual.html#userminusdefined-pragmas-macro-pragmas) changes: - Templates now accept macro pragmas. - Macro pragmas for var/let/const sections have been redesigned in a way that works |