Welcome to this year's seventh issue of Niteration, the newsletter for the Nit project.
Combined Changes for July 2015
Have contributed (or co-authored patches): Alexis Laferrière, Jean Privat, Alexandre Terrasa, Lucas Bajolet and Romain Chanoir.
It is official, http://nitlanguage.org is now generated with nitiwiki
. For the occasional reader, there are very few visible changes.
For the occasional contributor, the edition is linked with github and modifications are automatically proposed as Pull Request (or can be directly integrated for the some privileged contributors). The full repository of the website and its history is available athttps://github.com/nitlang/nitlanguage
The website regenerated through Jenkins http://gresil.org/jenkins/job/nitlanguage.org/. The regeneration is also quite faster since Nit is faster than Perl.
One of the best features of the Nit language is class refinement through module importation. A lot of our frameworks, like app.nit, use module importations to offer fine-grained modules that allow the final programmer to choose precisely which features and capabilities are required for each specific program.
Unfortunately, this extreme configurability has a drawback in simplicity since the precise selection of required modules might require work in case of complex applications or libraries: "why I must import android::audio
since my program already importsapp::audio
and is compiled with -m android
?"
The solution proposed is conditional importation. This proposal is the first Nit Enhancement Proposal; they will be used to track more easily the status of features. The main discussion being still done in github issues.
A proof of concept implementation of conditional importations was also merged. It allows modules to declare conditional importation rules.
Currently, these conditional importation are only used in the app.nit
framework. For instance, android::ui
is now conditionally imported when app::ui
and android
are both imported.
Strings in Nit are now UTF-8 aware.
var a = "あいうえお"
assert a.length == 5
assert a.bytelen == 15
assert a[2] == 'う'
assert a.substring(1,3) == "いうえ"
Many things have changed and operations on String will need to be considered differently to avoid bad surprises, namely:
Performances, for the user time of nitc src/nitc.nit -o bin/nitc
, has gone from 4.55s to 4.80s, so +5.5%; we have seen worse.
So a little slowdown, but definitely acceptable when introducing UTF-8 in Strings.
As a proof of concept, a new compiler was developed that produces Java code. It uses Java as an assembly language and does not try to map Nit OO concepts onto the Java OO concepts.
It is still in the early stage of development since neither collections or strings are handled (so no hello world yet). Nevertheless, it passes ~700/950 tests from the base*.nit test suite.
The contrib jwrapper was greatly improved. jwrapper automates the wrapping of Java classes for easy access from Nit, through the FFI.
jwrapper now works on full Jar archives and generate a signle Nit modules to wrap them. It was previously limited to wrapping only Java methods with simple types, now it supports static functions, constructors, attributes, generic parameters and primitive arrays. It also avoids property name conflicts and it scans other Nit modules for existing wrappers.
jwrapper can now wrap the java
and org
namespaces of the Java runtime library. The result can be used in semi-global compilation to access services of the Java standard library from Nit.
Example usage:
# Import the generated module wrapping a the `java` and `org` namespaces
import java_api
# Get a Java string
var str = java_lang_integer_to_string_int(5678)
# Do some Java side printing
java_lang_system_out.println_int 1234
java_lang_system_out.println_String str
We got two new machines, tolkien
and rrmartin
that are now used for continuous integration. While a lot of sanity points where consumed trying to configure Jenkins, this improves our daily workflow and allows us to run big integration tests more often.
Literal integers accept underscores in their literal representations.
Improve the error messages in autoinit conflict, and propose a resolution.
Rules are that a named constructor is expected to call super or the autosuperinit in order to be sanely attached to the inheritance hierarchy. If no such a call exists, an implicit call is injected (thus the name auto-super-init) or an error is displayed. For some historical reasons, the rule was not always enforced, this is now fixed.
Setters of attributes where private by default. This caused some issue as they are exposed as initializers but still invisible in client modules. The solution to resolve this inconsistency is to make setters protected by default so they are visible in client modules but only usable in subclasses.
Make that nitpick returns 1 if some errors where detected. This is more POLA and will helps callers to spot if there was errors in nit files given in arguments.
In nitdoc, wikilinks and some special commands are now usable on README files. It allows documentation writers to include and link parts of the API in the documentation of groups.
As a proof of concept, the Object and Sys classes of kernel are now documented in the README of standard:http://nitlanguage.org/doc/stdlib/group_standard.html
autobox
is now compiled in a more separate-proof way since the generated code is independent of global information (RTA).
Small improvement to make the initial make better. For the final user perspective, an useless error message is removed and the whole process should be slightly faster.
Introducing the binary serialization services. These services are compatible with the existing serialization API, so all sub-classes ofSerializable
are supported. The new engine is already in use by the games WBTW and Tinks!
The serialization format is somewhat similar to BSON. The main differences are the support for instances, the precise instance types (as in Array[MyClass]
), different data types id because we don't have the same data types and that we don't start off with the length of the stream. But we use a similar grammar, null-terminated lists and objects, as well as both a null-terminated string and a block which supports UTF-8.
Improvement on controls, assets loading and others unrelated small things.
Various lib improvements.
Various updates.