New
0.5.0
The most notable features of this new release are:
- Major syntax changes
- Immutability by default
- Tuples
- Checked subscript
- Performance improvements
Windows support is almost there and will probably be shipped in a minor release in the coming weeks.
Here is the full changelog
Major syntax changes
- Types are now specified after the identifier +
:(https://github.com/buzz-language/buzz/issues/310). This includes:- Variable declarations
- Function argument definitions
- Catch clauses
if (...: type as ...)
- Arrow function use
=>instead of-> - Comments and docblocks must now be prefixed by
//and///instead of|and|| - Bitwise or operator is
|instead of\ - Function type now use
funkeyword instead ofFunction - If a function type has multiple error types, they must be put in parenthesis
- Namespace can now be multiple
\separated identifiers - Qualified name now use
\separator instead of. - The
floattype is renamed todouble(https://github.com/buzz-language/buzz/issues/311) - Enum type is declared between
<>rather than() - Protocol list object is conforming to is declared between
<>rather than() constkeyword is renamed tofinal(https://github.com/buzz-language/buzz/issues/318)
Added
- Immutability by default (https://github.com/buzz-language/buzz/issues/139)
- All non-scalar values are immutable by default
- Mutability can be specified in types and for values with the
mutkeyword - Object methods that mutate
thismust be prefixed bymut - FFI data are considered mutable
- Compiler will warn about variable declared with
varbut never assigned - Object can have
finalproperties (https://github.com/buzz-language/buzz/issues/13) rg.subsetOf,rg.intersect,rg.union- Tuples (https://github.com/buzz-language/buzz/issues/298): syntaxic sugar over anonymous objects:
const tuple = .{ "john", "james" };
tuple.@"0" == "john";
- Checked subscript access to list and strings (gives
nullwhen index is out of bound) (https://github.com/buzz-language/buzz/issues/304):
var list = [1, 2, 3];
list[?10] == null;
"hello"[?20] == null;
- User input is syntax highlighted in REPL (https://github.com/buzz-language/buzz/issues/217)
- REPL handles multilines input (https://github.com/buzz-language/buzz/issues/218)
std\args(): returns the command line arguments with which the script was launched- Compiler is better at inferring empty list/map type from their context (https://github.com/buzz-language/buzz/issues/86)
Modified
- Enum can now have
rg,ud,void,patas value type - Anonymous object can also omit property name when initial value is a named variable
- Mir was updated to 1.0 (https://github.com/buzz-language/buzz/issues/300)
Fixed
- Type checking was not done on object instance property assignments
- Http client could not be collected because it kept connection opened to previous requests' domains
- Fixed an issue where a JIT compiled function making a lot of function calls would stack overflow
Internal
- Properties are now retrieved with an index rather than a hashmap lookup (https://github.com/buzz-language/buzz/issues/90) which gives a nice performance boost of about 40% on some benches