Keywords & Identifiers¶
Keywords¶
S++ uses a small set of keywords, to maintain simplicity. The keywords are not context dependant, and can therefore not be used as identifiers in non-keyword contexts. This makes the language easier to learn and understand, and to make the code more readable.
Most of the keywords are constrained to one use. This means that they are only seen in one context, and are not reused in other contexts.
Annotations are the same as Rust’s annotations, or C++ attributes. They are used to edit attributes of the AST nodes, but don’t introduce ASTs.
Keywords List¶
cls
: define a class (state only)sup
: define a superimpositionext
: extend a superimpositionfun
: define a function (subroutine)cor
: define a coroutineuse
: define a namespace reductiontype
: define a type aliascmp
: define a compile-time constant of genericlet
: define a variablemut
: mark a variable or borrow as mutablecase
: introduce a condition branchelse
: introduce an else block for branching or loopingloop
: introduce a loopwith
: introduce a context blockskip
: skip the current iteration of a loopexit
: exit a loopiter
: inspect a generated valueret
: return a value from a functiongen
: yield a value from a coroutineres
: advance a generatorasync
? : call a function asynchronouslywhere
? : introduce type constraints on a genericis
: introduce a type check & potential destructurein
: used withloop
for iteration based loopsof
: use patterns in acase
expressiontrue
: boolean literal for truefalse
: boolean literal for falseself
: reference to the current instanceSelf
: reference to the type of the current instanceand
: logical and binary operatoror
: logical or binary operatornot
: logical not postfix operatorcaps
: introduce captures for lambda functions
Annotations List¶
@virtual_method
: mark a method as virtual@abstract_method
: mark a method as abstract@public
: mark a symbol as public@protected
: mark a symbol as protected@private
: mark a symbol as private@cold
: mark a function as cold@hot
: mark a function as hot@inline
: prefer to inline a function@alwaysinline
: always inline a function
Future¶
@noinline
: don’t inline a function@friend
: define a friend for the symbol@deprecated/@obselete
: mark deprecation/obsolete@likely/@unlikely/@fallthrough
: conditionals@unroll/@allow_infinite
: loops