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).
object
generic types- Type values
- The new
var
keyword
Here is the full changelog:
Added
- FFI (#109)
- Uses MIR to generate wrappers around imported functions and to generate getters and setters to struct fields
- New
zdef
statement to declare and bind foreign functions and struct using zig code - New
ffi
std lib - When you need a pointer to something you can use the
Buffer
std lib object. Added:Buffer.writeZ
,Buffer.readZ
,Buffer.writeStruct
,Buffer.readStruct
Buffer.ptr
,Buffer.len
- New (fancy) error reporter (#153)
- Errors have now an associated code
os.sleep
- First class types (#21)
- Type can be passed around as values like so:
<str>
- New
typeof
operator returns type of any value:typeof "hello"
-><str>
- Type can be passed around as values like so:
- Delimiters for non-standard identifiers (#138)
- Collectors (#2): if an
object
has afun collect() > void
method, it will be called before an instance of this object is collected by the garbage collector - Helpers around
ud
std.toUd
, returns userdata from an int or floatbz_valueToObjUserData
bz_getUserDataPtr
Buffer.readUserData
,Buffer.writeUserData
std.serialize
takes 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
(#39) - New integer literal for single chars:
'A' == 65
(#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
(#162)map.sort
,map.forEach
,map.map
,map.filter
,map.reduce
,map.diff
,map.intersect
,map.clone
(#110)list.clone
(#110)- Number literals can embed
_
:1_000_000.300_245
(#163) - Type can be inferred when declaring a variable/constant with the
var
orconst
keyword:var something = "hello"
(#194) - Objects can have generic types (#82)
- Draft of the testing std lib (#129)
File.isTTY
fs.exists
- Functions annotated with a comment of the form
|| @hot
will always be JIT compiled
Changed
json
lib is renamedserialize
Json
now returns aBoxed
object (which can be reused in other contexts than JSON)- Identifiers can now have
_
since pattern delimiters have changed - Changed pattern delimiters to
$"..."
(#165) list.append
does 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
null
initial 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