Welcome to this year's seventh issue of Niteration, the newsletter for the Nit project.
Combined changes for October 2015:
Have contributed (or co-authored patches): Jean Privat, Alexandre Terrasa, Alexis Laferrière, Lucas Bajolet.
Introduce multi-iterators in for.
A single for can now iterate over more than one collection at once. An iterator is used for each collection and the iteration is finished once the shortest iterator is finished.
for i in [10, 20, 30], j in [1..10] do print i+j # outputs 11 22 33
As expected by POLA, multi-iterators are also naturally usable on maps and comprehension arrays
var m = new HashMap[Int,String]
m[1] = "one"
m[2] = "two"
for k, v in m, i in [1..10] do print "{k}:{v}:{i}"
# outputs 1:one:1 2:two:2
var a = [for i in [10, 20, 30], j in [1..10] do i + j]
print a # outputs [11, 22, 33]
Introducing autonomous packages, they should be coherent and work as is without specific user hack.
The fixed issues are:
The absence of required source files (eg. because generated by nitcc or nitserial) that make tools unusable or report errors. The proposed solution is a new optional Makefile goal pre-build that has to generate the missing files. close #1720
The requirement of arbitrary -I that make the tools (eg the vim plugin) unusable on the projects without prior knowledge. The only project that uses a rogue -I is online_editor that require things from nitc. The proposed solution is to virtually move src to contrib/nitc as a symbolic link. New project could then choose to import nitc (or parts of it) without being in src.
The presence of broken nit files. Currently, only 3 broken files remain: contrib/pep8analysis/src/parser/parser_abs.nit,contrib/nitc/parser/parser_abs.nit and contrib/nitcc/src/nitcc_lexer0.nit. These are still open issues and will be dealt with later.
Merge: Rationalize the usage of tools on packages deaa490
A lot a bugfixes to the tools where commited this month. Most of them concern unchecked codepath with some rare options. Others are related to robustness.
The main improvement is a is_broken flag on all entities that simplify the client's code to check the validity of entities before working with them.
Another important change is the use of bottom types to indicate broken or inconsistent types. This last change makes the whole model more robust since bottom types are sometimes returned instead of aborting.
-e and -n on nit 4455de8The internal loader was refactorized and updated. The most important change is a simplification and an harmonization of the API. Especially, the class ModulePath was removed (in favor of using genuine MModule objects), and a scan_full method was added to analysis path passed as command arguments without loading the modules. By the way, the option -d (and -M) of nitls that were broken by the previous changes in the loader are now fixed, and nitcalatog works on directories of projects now. eg. nitcatalog ../lib
scan_full or parse_full e0c115eThis series fixes some long issues. The main change is the improvement of the method HightlightVisitor::enter_visit that highlights only the given node instead of the whole file.
Moreover, two new flags can be used to indicate how to deal with the context around the node to highlight.
The model, is extended with a basic visitor infrastructure. This offers an alternative for clients to navigate within a Nit model using a visitor design pattern. In the same time, is_fictive is promoted to any MEntity to denote internal entities that should not be exposed to the user.
We did a tedious work to detect and fix undocumented options in the manpages of tools. We also synchronized the description of --help and the text in manpages (when there is a diversion, the best one was often selected).
Little extra: a new script check_manpage can automatically check that new options of tools are documented in the man.
Moreover the README in the root directory was a little updated.
The script nit_env.sh tries to auto-magically configure PATH, MANPATH and bash completion for users. The point is to be as portable and simple as possible for the final user, as he just has to write
$ source misc/nit_env.sh
and get a working setup.
Moreover, if install is given as argument, then the script registers itself to the user's $HOME/.profile.
$ source misc/nit_env.sh install
One advantage is that the script invocation is registered in .profile, thus, future evolutions of the script will be used automatically in future sessions of the users.
Opportunity now stores local participant's name in a cookie. So we don't have to write our own name every single time we participate to an event.
It also features the ∇ ratio with a customizable multiplier. It assigns a weight to the choices of participants so that someone who select all possible answers puts less weight on each answer, and someone who chooses a single answer puts her full weight on it. It can be used to count the number of pizzas to order (with a multiplier of 0.4) and to give more importance to the available times of busy people when scheduling a meeting.
lib/nlp wraps Stanford CoreNLP and provides a set of natural language analysis tools which can take raw text input and give the base forms of words, their parts of speech, whether they are names of companies, people, etc., normalize dates, times, and numeric quantities, and mark up the structure of sentences in terms of phrases and word dependencies, indicate which noun phrases refer to the same entities, indicate sentiment, etc. This wrapper needs the Stanford CoreNLP jars that run on Java 1.8+.
var proc = new NLPProcessor("path/to/StanfordCoreNLP/jars")
var doc = proc.process("String to analyze")
for sentence in doc.sentences do
for token in sentence.tokens do
print "{token.lemma}: {token.pos}"
end
end
hexdigest service on Text f0adfb2While working on nitlight, some performance improvements were made on the underlying libraries.
html_escape for FlatText variants c3512b9Various cleanup and bugfixes