-
Notifications
You must be signed in to change notification settings - Fork 0
Global static keyword proposal #12
Copy link
Copy link
Open
Labels
FeatureThis issue or PR contains a new feature.This issue or PR contains a new feature.FutureThis issue or PR is something that will be added in the future.This issue or PR is something that will be added in the future.High PriorityHigh profile, important issue that needs to be focused onHigh profile, important issue that needs to be focused on
Metadata
Metadata
Assignees
Labels
FeatureThis issue or PR contains a new feature.This issue or PR contains a new feature.FutureThis issue or PR is something that will be added in the future.This issue or PR is something that will be added in the future.High PriorityHigh profile, important issue that needs to be focused onHigh profile, important issue that needs to be focused on
Type
Fields
Give feedbackNo fields configured for issues without a type.
Similar to class implementation, you should be able to store variables on STACK rather than HEAP with the static keyword.
Please note that the implementation of
staticon a class property or method is different from global statics. Method and properties of classes will remain on HEAP.Example implementation:
It is important to note, if you do not declare a static global as
publicit is disposed after it is owned. (this can be disabled with compiler flags)Why? Allocating known strings or any related interface on heap is more time consuming than allocating on stack. Allocating on stack allows us to shorten instruction size into a single instruction, as well as allowing better lifetime control of the variable.
Please note this RFC will not be as efficient without lifetimes enabled