New
0.3.0
The most notable features of this new release are:
- The introduction of FFI allowing buzz to call C functions very easily (see this example using SDL).
objectgeneric types- Type values
- The new
varkeyword
Here is the full changelog:
Added
- FFI (https://github.com/buzz-language/buzz/issues/109)
- Uses MIR to generate wrappers around imported functions and to generate getters and setters to struct fields
- New
zdefstatement to declare and bind foreign functions and struct using zig code - New
ffistd lib - When you need a pointer to something you can use the
Bufferstd lib object. Added:Buffer.writeZ,Buffer.readZ,Buffer.writeStruct,Buffer.readStructBuffer.ptr,Buffer.len
- New (fancy) error reporter (https://github.com/buzz-language/buzz/issues/153)
- Errors have now an associated code
os.sleep- First class types (https://github.com/buzz-language/buzz/issues/21)
- Type can be passed around as values like so:
<str> - New
typeofoperator returns type of any value:typeof "hello"-><str>
- Type can be passed around as values like so:
- Delimiters for non-standard identifiers (https://github.com/buzz-language/buzz/issues/138)
- Collectors (https://github.com/buzz-language/buzz/issues/2): if an
objecthas afun collect() > voidmethod, it will be called before an instance of this object is collected by the garbage collector - Helpers around
udstd.toUd, returns userdata from an int or floatbz_valueToObjUserDatabz_getUserDataPtrBuffer.readUserData,Buffer.writeUserData
std.serializetakes any buzz value and return a serializable version of it (objects become maps, etc.) provided the data is has no circular reference and does not contain not serializable values (functions, fibers, etc.)- UTF8 helpers:
str.utf8Len,str.utf8Codepoints,str.utf8Valid(https://github.com/buzz-language/buzz/issues/39) - New integer literal for single chars:
'A' == 65(https://github.com/buzz-language/buzz/issues/172) - Compiler will warn you when a local or global is never used or when an expression value is discarded. To silence those warnings you can use the
_ = <expression>or name the local/global_. std.currentFiber,fiber.isMain(https://github.com/buzz-language/buzz/issues/162)map.sort,map.forEach,map.map,map.filter,map.reduce,map.diff,map.intersect,map.clone(https://github.com/buzz-language/buzz/issues/110)list.clone(https://github.com/buzz-language/buzz/issues/110)- Number literals can embed
_:1_000_000.300_245(https://github.com/buzz-language/buzz/issues/163) - Type can be inferred when declaring a variable/constant with the
varorconstkeyword:var something = "hello"(https://github.com/buzz-language/buzz/issues/194) - Objects can have generic types (https://github.com/buzz-language/buzz/issues/82)
- Draft of the testing std lib (https://github.com/buzz-language/buzz/issues/129)
File.isTTYfs.exists- Functions annotated with a comment of the form
|| @hotwill always be JIT compiled
Changed
jsonlib is renamedserializeJsonnow returns aBoxedobject (which can be reused in other contexts than JSON)- Identifiers can now have
_since pattern delimiters have changed - Changed pattern delimiters to
$"..."(https://github.com/buzz-language/buzz/issues/165) list.appenddoes not return the appended value anymore- Generic types syntax changed from
myFunction(<K,V>, ...)tomyFunction::<K,V>(...) - Nullable object fields and nullable variables have a
nullinitial value if none is provided - Migrated to pcre2 which is now a submodule built by build.zig
- Mimalloc is now a submodule built by build.zig
Fixed
- Some bugs
any - Runtime error stack trace was wrong
- Local name checking failed in some instances
- Compiler would not force you to give variables an initial value
- Compiler would crash after raising some errors
- Float operation were sometimes wrong
- Catch clause were sometimes not reached in a JIT compiled function
- Stacktraces of errors reported from within a fiber were wrong
catch (any error)was not considered as catching all possible errors by the compiler- Full GC sweep were never triggered