push and pop pragmas
The push/pop pragmas are very similar to the option directive, but are used to override the settings temporarily. Example:
{.push checks: off.}
# compile this section without runtime checks as it is
# speed critical
# ... some code ...
{.pop.} # restore old settings
push/pop can switch on/off some standard library pragmas, example:
{.push inline.}
proc thisIsInlined(): int = 42
func willBeInlined(): float = 42.0
{.pop.}
proc notInlined(): int = 9
{.push discardable, boundChecks: off, compileTime, noSideEffect, experimental.}
template example(): string = "https://nim-lang.org"
{.pop.}
{.push deprecated, used, stackTrace: off.}
proc sample(): bool = true
{.pop.}
For third party pragmas, it depends on its implementation but uses the same syntax.
当前内容版权归 nim-lang.org 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 nim-lang.org .