What's New
givestatement - needed at end of block andifexpressions- block expressions
x := {
y := 123;
give y-1;
};
ifexpressions
x := if cond {
y := 123;
give y-1;
} else {
y := 321;
give y+1;
};
whileloop
while cond {
}
while x := 0; x < 123 {
x += 1;
}
- New style
forloop
list := []int{1, 4, 7, 3, 7, 2, 1};
for value : list {
fmt.println(value);
}
for val, idx : 12 ..< 17 {
// Iterates from 12 to 16 (inclusive)
// Optional index value: `idx`
fmt.println(val, idx);
}
msg := "Hellope";
for r : msg {
// r is a `rune` as this procedure iterates
// the utf-8 string and returns the corresponding
// codepoint or `rune`
fmt.println(r);
}
- New style enumerations (Most likely to change)
Byte_Size :: enum f64 {
_, // Ignore first value
KB = 1<<(10*iota), // 1<<10
MB, // 1<<20
GB, // 1<<30
TB, // 1<<40
PB, // 1<<50
}
- Updates to the core library to accommodate the new features
Removed Features
- Automatic semicolon insertion in favour of "mandatory" semicolons.
- Semicolons are optional in a few cases but mainly for sanity reasons
- Nested constants from within certain records
- Increment and decrement operators:
++-- - Capacity value in slices
- Slices are now just a pointer and count
appendbuilt in procedure- capacity arguments in
new_sliceandslice_ptr enum_to_stringbuilt in procedure- This may come back if enumerations change their behaviour