You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came up with the idea of the @static_assert(condition) annotation. STANDALONE annotations, unlike statements, can be located anywhere in the script, not necessarily inside a function (for example, _init). Annotations are checked at compile time (in the analyzer), not at runtime (so you will know about the error even before the project starts). Annotation arguments can be any constant expressions.
@static_assert could be used to validate the values of constants, enums and other similar conditions - if you use constants as a config and can change their values, but are worried that you might forget about some condition and set incorrect values. (We should consider making expressions like MyEnum.size() and MyEnum.values().max() constant.)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I came up with the idea of the
@static_assert(condition)
annotation.STANDALONE
annotations, unlike statements, can be located anywhere in the script, not necessarily inside a function (for example,_init
). Annotations are checked at compile time (in the analyzer), not at runtime (so you will know about the error even before the project starts). Annotation arguments can be any constant expressions.@static_assert
could be used to validate the values of constants, enums and other similar conditions - if you use constants as a config and can change their values, but are worried that you might forget about some condition and set incorrect values. (We should consider making expressions likeMyEnum.size()
andMyEnum.values().max()
constant.)Beta Was this translation helpful? Give feedback.
All reactions