Skip to content

Kuroko v1.3.0 (release candidate)

Pre-release
Pre-release
Compare
Choose a tag to compare
@klange klange released this 31 Jul 21:44
· 262 commits to master since this release

This is a release candidate and not a final release.

This is Kuroko, a dynamic, bytecode-compiled, interpreted language with significant whitespace and familiar syntax.

For a complete tutorial and sample code, please visit kuroko-lang.github.io.

If you believe you have discovered a bug in this release, please file an issue report here on Github or join #toaruos on Libera.chat to discuss the problem.

What's new in 1.3.0

Over 200 commits have been made since 1.2.5, including several major feature additions, bug fixes, and C API improvements.

Major Features

  • Optimized method invocations reduce object allocation pressure when calling bound methods.
  • Cached method operators eliminate hash lookup costs when using built-in operators.
  • More operator overloads including in-place ops (+=, etc.), unary +, infix @ (__matmul__)
  • Support for else branches in for, while, try for branches to execute upon successful completion.
  • Relative imports and improved package module support, with a new import resolution strategy.
  • Arbitrary precision integers with a new long type, using an integrated bigint implementation and with seamless switchover from small ints.
  • Exception contexts and causes when raising within an except block or with raise ... from ....
  • Format specs and = in f-strings with the addition of __format__.
  • __setattr__ and __set_name__ methods
  • Updated codecs module

Other Improvements and Bug Fixes

  • Added comparator methods for lists and tuples.
  • Some loops and iterator operations have been optimized.
  • Implemented Python name mangling for private identifiers in classes.
  • The compiler now supports concatenating unalike string tokens (f-strings, r-strings, and regular strings).
  • Issues with memory allocation tracking that resulted in over-eager garbage collection have been resolved.
  • Reallocation of value stacks used in C native functions is now deferred until the function returns.
  • Global namespaces are now bound to functions, not codeobjects, and functions objects can be built at runtime from codeobjects combined with appropriate upvalue sources and global tables (either through an instance or dict).
  • The compiler now builds expressions directly and the repl will only print the results of expression statements, rather than peeking beyond the top of the stack to find statement values.
  • The dis module can now be used with -m to compile and print a disassembly of source inputs, recursively, without running them.
  • Type hints can now be added to local declarations, and are computed and stored when functions are created in a manner similar to arguments. The keys for these type hints are indexes into the local names table, where the actual names and valid lifetimes on the variables can be found.
  • The binding for ** has been corrected to match Python, binding to the right, so 2 ** 3 ** 4 is equivalent to 2 ** (3 ** 4) instead of (2 ** 3) ** 4.
  • All global state has been consolidated to the VM state and threadstate objects in the interpreter.
  • The scanner and compiler are now reentrant.
  • Upvalue capture in generators has been improved.
  • When breaking or continueing from within a with or try, __exit__ handlers and finally: blocks are now executed correctly.
  • krk_runfile() now provides the exit frame guarantees krk_callfile provided, making krk_callfile redundant; it has been removed.
  • A new string formatter has been implemented for krk_runtimeError, supporting several common usecases such as printing the type name of an object, directly printing KrkString* objects, and calling repr on arguments.
  • __pow__ is now supported on ints by default. (float.__pow__ still requires import math to be bound to a libm implementation of pow())