[niteration] July 2015

11 views
Skip to first unread message

Jean Privat

unread,
Aug 3, 2015, 2:24:20 PM8/3/15
to nitlanguage

Welcome to this year's seventh issue of Niteration, the newsletter for the Nit project.

Combined Changes for July 2015

  • changes: v0.7.6 .. v0.7.7
  • shortstat: 334 files changed, 11484 insertions(+), 2509 deletions(-)
  • pull requests: 40
  • non-merge commits: 315

Have contributed (or co-authored patches): Alexis Laferrière, Jean Privat, Alexandre Terrasa, Lucas Bajolet and Romain Chanoir.


Highlight of The Month

New Website Engine

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.

  • Merge: Some bugfixes and small improvements for nitiwiki 09a418c

Conditional Importation

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.

  • Merge: Conditional importation 1562eb3

Bytes, Strings and Unicode

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:

  • FlatBuffers are slow as hell when getting chars or modifying in-place (and an in-place modification can degenerate if a single-byte char is modified by a multibyte char)
  • Length is now potentially expensive (especially within FlatBuffer where it is not cached)
  • Indexed access is now O(n), though it is cached for local accesses (except in FlatBuffer)

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.

  • Merge: Bytes migration 1868f4a
  • Merge: lib/standard/bytes: Added pop method 2532783
  • Merge: UTF-8 Strings c322d37
  • Merge: Cached ropes 4f36319
  • Merge: NSieve optimization e38cdea

Nitj: A compiler to Java code

  • Merge: Nitj: A compiler to Java code. 067a390

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.

jwrapper

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
  • Merge: jwrapper accepts Jar archives 5445a40
  • Merge: jwrapper generates full APIs, with constructors, getters and setters 07860cc
  • Merge: jwrapper supports static properties, primitive arrays and generic parameters 2bfe887

New machines

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.


Languages and Tools

Literal integers accept underscores in their literal representations.

  • Merge: Decimal literals with underscores 2ecf60d
  • Merge: misc/vim: highlight the new Int literals b34c89b

Improve the error messages in autoinit conflict, and propose a resolution.

  • Merge: Better autoinit conflict message 95792f7

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.

  • Merge: Fix nitpick return value 98d5a06

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

  • Merge: nitdoc: Use wikilinks on README files 14b7838
  • Merge: Improve documentation of kernel 34a7990

autobox is now compiled in a more separate-proof way since the generated code is independent of global information (RTA).

  • Merge: Separate code compilation for autobox c51e6df

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.

  • Merge: Improve initial make c572fc3

Libraries

Binary serialization

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.

  • Merge: Binary serialization 3b39f8d

Android

Improvement on controls, assets loading and others unrelated small things.

  • Merge: Tweaks to the Android support b0dbd98
  • Merge: Fix Chainz of Friendz buttons on Android b833e59
  • Merge: A little fix to android::audio 7dfb195

Miscellaneous

Various lib improvements.

  • Merge: Intro the performance_analysis module to gather perf stats by categories 97b4532
  • Merge: Intro HashMap23::has, Timespec::millisec|microsec and misc clean up 0bfb381
  • Merge: lib/geometry: intro more services on points and for angles ec93b7f
  • Merge: Fix bug with reverse iterators in arrays 23e3bf5
  • Merge: Rename Container to Ref e3246a0
  • Merge: lib/noise: compatibility with 32 bits arch and noisier 2d22534
  • Merge: Fix lib/realtime on osx 57baffe
  • Merge: Apply optional params in strip_extension, basename and join db4a990
  • Merge: Faster write 01a1eb5
  • Merge: Basic UDP socket 1eeffca
  • Merge: lib/std: add Path::last_error to aggregate errors on path services. 2a30b5d

Contrib and Examples

Various updates.

  • Merge: contrib/inkscape_tools: Report invalid files and cleaner Makefile 6784903
  • Merge: contrib/rss_downloader: compressed feeds and report errors 424288b
  • Merge: Rosetta Code: S-Expressions b838f64
  • Merge: Rosetta entropy b332a6d
Reply all
Reply to author
Forward
0 new messages