Skip to content

0.4.0

Latest
Compare
Choose a tag to compare
@giann giann released this 16 May 13:16
· 79 commits to main since this release

The most notable features of this new release are:

  • REPL
  • WASM build and web REPL
  • Tracing JIT

Here is the full changelog:

Added

  • REPL (#17) available by running buzz without any argument
  • WASM build (#142) and web REPL
  • Tracing JIT (#134): will look for hot loops and compile them
  • Tail call optimization (#9)
  • Function argument names and object property names can be omitted if the provided value is a named variable with the same name (#204)
object Person {
    str name,
    str lastName,
}

const name = "Joe";
const lastName = "Doe";

before:

const person = Person {
    name: name,
    lastName: lastName,
};

after:

const person = Person {
    name,
    lastName,
};
  • Sandboxing build options memory_limit and cycle_limit (#182)
  • Block expression (#105):
var value = from {
    | ... 

    out result;
}
  • recursive_call_limit build option limit recursive calls
  • Compiler will warn about code after a return statement
  • Compiler will warn about unreferenced imports (#272)
  • namespace (#271): if a script exports at least one symbol, it has to define a namespace for the script with namespace mynamespace
    • By default, imported symbols from another script will be under libprefix.XXXX
    • When importing something, you can still redefine its namespace prefix with import "..." as mynewnamespace or remove it altogether with import "..." _
  • Ranges are now an actual buzz value (#170)
    • new rg type
    • myrange.toList() transforms a range into a list of integers
    • myrange.low and myrange.high to get a range bounds
    • works with foreach
  • list.fill
  • std.panic will panic and print current stack trace
  • Loop can have labels that you can break or continue to (#199)

Changed

  • Map type notation has changed from {K, V} to {K: V}. Similarly map expression with specified typed went from {<K, V>, ...} to {<K: V>, ...} (#253)
  • File.readLine, File.readAll, Socket.readLine, Socket.readAll have now an optional maxSize argument
  • Empty list and map without a specified type resolve to [any]/{any: any} unless the variable declaration context provides the type (#86)
  • Function yield type is now prefixed with *>: fun willYield() > T > Y? becomes fun willYield() > T *> Y? (#257)
  • Temporarily disabled --tree and --fmt. The AST has been completely reworked and those feature will take some work to come back.
  • math.random removed in favor of std.random

Fixed

  • A bunch of crash after reported error. buzz tries to hit a maximum of syntax/compile errors by continuing after an error has been reported. This can lead to unexpected state and crash.
  • Trying to resolve a global when only its prefix was provided would result in infinite recursion
  • Forbid use of yield/resume/resolve in the global scope
  • Would break on unfinished char literal

Note: No binaries are provided until I figure out #226