Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the meaning of "magic" pragma in nim?

Tags:

nim-lang

When going through the code in Nim project itself, I find that some proc decorated by "magic" pragma misses proc definition (example). There's no doc to explain the pragma, I guess the proc's definition is somewhere else and is merged while compiling.But I cannot still find the definition by searching the whole project.

Do I misunderstand the "magic" pragma? What's the meaning of it? And how to use it?

like image 751
Roger Avatar asked Aug 31 '15 06:08

Roger


1 Answers

The {.magic.} pragma is used to define built-in operations and types, i.e. anything that requires compiler magic in order to work (hence the name). It is not intended to be used outside the system modules.

like image 81
Reimer Behrends Avatar answered Sep 18 '22 12:09

Reimer Behrends