Join Slack
Powered by
Hi, when exactly package level variable gets initi...
# announcements
d
Dias
12/11/2018, 4:51 PM
Hi, when exactly package level variable gets initialized? when it is imported like in python?
Dias
12/11/2018, 5:05 PM
looks like it's not even initialized on import. Is it lazy init?
d
Dico
12/11/2018, 5:37 PM
I assume that's platform dependant. On the JVM, it will be lazy because it uses static initializers.
Dico
12/11/2018, 5:38 PM
In native and js, I don't know.
Dico
12/11/2018, 5:39 PM
I would guess the teams of the respective platforms realized that lazy initialization is perhaps the better approach
Dico
12/11/2018, 5:40 PM
In the end, all initialization needs to occur after the main function invocation, so I actually am not sure how else it would be done.
Dico
12/11/2018, 5:40 PM
JS might be a special bean though
3
Views
Open in Slack
Previous
Next