Keywords
Karkain reserves the following words. They cannot be used as identifiers
(function names, variable names, field names, etc.). This table is
authoritative against the lexers (pkg/lexer/lexer.go,
src/compiler/lexer.kark); a word is a keyword only if a lexer emits
it as one.
Complete keyword list
Keyword |
Purpose |
|---|---|
|
Function declaration |
|
Function declaration / lambda closure |
|
Immutable variable declaration |
|
Mutable variable declaration |
|
Constant declaration (compile-time evaluated) |
|
Type declaration |
|
Struct declaration |
|
Enum declaration |
|
Linear (exactly-once) type modifier |
|
Padding-free struct modifier |
|
Conditional expression / statement |
|
Alternate branch of |
|
Loop (documented form |
|
Loop (C-style or |
|
Iteration in |
|
Return from function |
|
Exit innermost loop |
|
Skip to next iteration |
|
Pattern matching (arms use |
|
Module import |
|
Public export modifier |
|
Boolean literal |
|
Boolean literal |
|
|
|
|
|
Output (same token) |
|
Raw memory operations |
|
Borrow and ownership modifiers |
|
Spawn a concurrent task |
|
Receive from a channel |
|
Create a channel |
|
Create an actor |
|
Send a message on a channel (reserved) |
|
Matrix declaration |
|
GPU compute surface (reserved) |
|
Quantum surface (reserved) |
|
Metaprogramming surface (reserved) |
Note
These look like keywords but are not: nil (use None),
assert / assert_eq / assert_ne / test / wait_all
(builtins and test-runner conventions), actorSend /
actorState / setActorState / actorStop (library
functions). Only the table above is reserved.
Type keywords
These are reserved as type names and cannot be used as identifiers:
Keyword |
Meaning |
|---|---|
|
64-bit signed integer |
|
64-bit IEEE-754 float |
|
Boolean |
|
UTF-8 byte string |
|
Dynamic array type |
|
Arbitrary-precision integer (GMP-backed) |
|
Arbitrary-precision float (GMP-backed) |