Kuroko v1.3.0 (release candidate)
Pre-release
Pre-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 infor
,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 smallint
s. - Exception contexts and causes when raising within an
except
block or withraise ... 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
list
s andtuple
s. - 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, so2 ** 3 ** 4
is equivalent to2 ** (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
break
ing orcontinue
ing from within awith
ortry
,__exit__
handlers andfinally:
blocks are now executed correctly. krk_runfile()
now provides the exit frame guaranteeskrk_callfile
provided, makingkrk_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 printingKrkString*
objects, and callingrepr
on arguments. __pow__
is now supported onint
s by default. (float.__pow__
still requiresimport math
to be bound to a libm implementation ofpow()
)