Re: Understanding Pragmas

2020-07-10 Thread michy
What I'm missing in the docs:

  * Syntax of pragma content
  * allowed locations




Re: Understanding Pragmas

2020-07-09 Thread Salient
Awesome thank you that cleared things up quite a bit.


Re: Understanding Pragmas

2020-07-09 Thread treeform
Pragmas are just a way to attach more info to the functions.

The compiler takes the data in the pragmas and does some thing special with it.

Take the {.inline.} pragma it just marks the functions with inline=true and 
then when compiler sees the function it inlines it.

You can also create your own pragmas and use them in your own code.

You can also use pragmas with macros. Most famous example is the {.async.} 
pragma which chops a linear function into several sections and provides async 
capabilities.

Pragmas can be used for so many things, here is a massive list: 
[https://nim-lang.org/docs/manual.html#pragmas](https://nim-lang.org/docs/manual.html#pragmas)

Other languages have keywords such as static, final, inline... but you can't 
add your own keywords like that, but in nim you can... through pragmas.


Understanding Pragmas

2020-07-09 Thread Salient
Hey guys! I'm really trying to understand Nim and make this language my main.

I'm having problems understanding pragmas. I've bought Nim in action, I've read 
tutorials and documentation on it but everything I've read is very generic and 
"thin" in explanation.

Can someone help explain this in depth please? And it's use cases?