Skip to content

0.5.0

Latest
Compare
Choose a tag to compare
@giann giann released this 24 Jan 10:52
· 4 commits to main since this release

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 + : (#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 fun keyword instead of Function
  • 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 float type is renamed to double (#311)
  • Enum type is declared between <> rather than ()
  • Protocol list object is conforming to is declared between <> rather than ()
  • const keyword is renamed to final (#318)

Added

  • Immutability by default (#139)
    • All non-scalar values are immutable by default
    • Mutability can be specified in types and for values with the mut keyword
    • Object methods that mutate this must be prefixed by mut
    • FFI data are considered mutable
  • Compiler will warn about variable declared with var but never assigned
  • Object can have final properties (#13)
  • rg.subsetOf, rg.intersect, rg.union
  • Tuples (#298): syntaxic sugar over anonymous objects:
const tuple = .{ "john", "james" };

tuple.@"0" == "john";
  • Checked subscript access to list and strings (gives null when index is out of bound) (#304):
var list = [1, 2, 3];

list[?10] == null;

"hello"[?20] == null;
  • User input is syntax highlighted in REPL (#217)
  • REPL handles multilines input (#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 (#86)

Modified

  • Enum can now have rg, ud, void, pat as value type
  • Anonymous object can also omit property name when initial value is a named variable
  • Mir was updated to 1.0 (#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 (#90) which gives a nice performance boost of about 40% on some benches