Re: {.global.} in global scope

2020-01-06 Thread Araq
It's about initialization order, .global globals are initialized before other 
globals. Something like that, tbh I don't remember either. :-)


Re: {.global.} in global scope

2020-01-05 Thread hasan
I am curious about this, too. In the documentation, I couldn't see any other 
mention of this pragma other than using it in a proc body to make it work like 
a _static_ object in other languages. However, I don't know what it does for a 
global variable.

If it was only this repository, I would say it is from two years ago and maybe 
meant something else at that time and the repository is not maintained. 
However, I saw the same usage in a lot of other places throughout the standard 
library and/or compiler code base.

Possibly something related to access to variable from multiple threads?

Anybody? :)


{.global.} in global scope

2019-12-25 Thread dawkot
What does the global pragma do the way it is used 
[here](https://github.com/Araq/ormin/blob/master/examples/forum/forum.nim)? 


import "../ormin/ormin", json

importModel(DbBackend.sqlite, "forum_model")

var db {.global.} = open("stuff", "", "", "")
...


Run