nit.git
9 years agoMerge: Improve tool ui
Jean Privat [Tue, 4 Nov 2014 20:07:42 +0000 (15:07 -0500)]
Merge: Improve tool ui

Small fixes to improve the user-interface of tools.

* nit_dir is more robust and display errors if invalid
* option --nit-dir is really needed
* remove useless and buggy --clib-path and NIT_CC_PATH
* nit does not collect options after the program file but let as options for the interpreter
* 3 -v to show class-level information, 4 -v to show property-level information

Pull-Request: #873
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoMerge: Manual: rewrite the man for nitg
Jean Privat [Tue, 4 Nov 2014 20:07:40 +0000 (15:07 -0500)]
Merge: Manual: rewrite the man for nitg

If people like it, I may write the manpage for the other tools.

I generated the markdown to http://nitlanguage.org/tools/nitg/ so you could see the rendered result in HTML.
I plan to have pages for the tools automatically synchonized from the files in /share/man.

Pull-Request: #871
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agoMerge: neo: Load the graph in chunks and only once.
Jean Privat [Tue, 4 Nov 2014 20:07:17 +0000 (15:07 -0500)]
Merge: neo: Load the graph in chunks and only once.

With this fix, `neo.nit` now takes approximately 2 Gio of memory to load the graph for Apache Xerces.

Fixes #870.

Pull-Request: #872
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agoneo_doxygen: Enhance the display of the progression.
Jean-Christophe Beaupré [Tue, 4 Nov 2014 19:25:20 +0000 (14:25 -0500)]
neo_doxygen: Enhance the display of the progression.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoconsole: Add sequences for cursor moving and erasing.
Jean-Christophe Beaupré [Tue, 4 Nov 2014 19:24:14 +0000 (14:24 -0500)]
console: Add sequences for cursor moving and erasing.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoc_src: update the Maklefile to protect the pkg-config commands
Jean Privat [Tue, 4 Nov 2014 16:39:14 +0000 (11:39 -0500)]
c_src: update the Maklefile to protect the pkg-config commands

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoffi/pkgconfig: use the new pkgconfig infrastructure in the Makefile
Jean Privat [Tue, 4 Nov 2014 16:35:32 +0000 (11:35 -0500)]
ffi/pkgconfig: use the new pkgconfig infrastructure in the Makefile

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoabstract_compiler: check the presence of pkgconfig libraries in the Makefile
Jean Privat [Tue, 4 Nov 2014 16:28:27 +0000 (11:28 -0500)]
abstract_compiler: check the presence of pkgconfig libraries in the Makefile

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoneo_doxygen: Check the project’s name.
Jean-Christophe Beaupré [Sat, 1 Nov 2014 04:14:45 +0000 (00:14 -0400)]
neo_doxygen: Check the project’s name.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoneo_doxygen: Make the command user-friendly.
Jean-Christophe Beaupré [Sun, 2 Nov 2014 22:12:52 +0000 (17:12 -0500)]
neo_doxygen: Make the command user-friendly.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoneo_doxygen: Import type parameters
Jean-Christophe Beaupré [Thu, 30 Oct 2014 20:37:46 +0000 (16:37 -0400)]
neo_doxygen: Import type parameters

Not tested yet.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoneo_doxygen: Import parameters.
Jean-Christophe Beaupré [Sun, 2 Nov 2014 21:32:55 +0000 (16:32 -0500)]
neo_doxygen: Import parameters.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoneo_doxygen: Isolate language-specific code.
Jean-Christophe Beaupré [Sun, 2 Nov 2014 21:13:38 +0000 (16:13 -0500)]
neo_doxygen: Isolate language-specific code.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoneo_doxygen: Import members’ type.
Jean-Christophe Beaupré [Sun, 2 Nov 2014 21:02:58 +0000 (16:02 -0500)]
neo_doxygen: Import members’ type.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoneo_doxygen: List members.
Jean-Christophe Beaupré [Tue, 4 Nov 2014 14:33:25 +0000 (09:33 -0500)]
neo_doxygen: List members.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoneo_doxygen: Add types to the model.
Jean-Christophe Beaupré [Sun, 2 Nov 2014 22:12:11 +0000 (17:12 -0500)]
neo_doxygen: Add types to the model.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoneo_doxygen: Name class’ type and definition.
Jean-Christophe Beaupré [Fri, 24 Oct 2014 15:51:03 +0000 (11:51 -0400)]
neo_doxygen: Name class’ type and definition.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoneo_doxygen: Avoid clearing the namespace’s id of a module.
Jean-Christophe Beaupré [Fri, 24 Oct 2014 15:47:07 +0000 (11:47 -0400)]
neo_doxygen: Avoid clearing the namespace’s id of a module.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoneo_doxygen: Enhance error handling in shell scripts.
Jean-Christophe Beaupré [Fri, 24 Oct 2014 18:50:23 +0000 (14:50 -0400)]
neo_doxygen: Enhance error handling in shell scripts.

Also, stop `gen-all.sh` on first error.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoneo_doxygen: Add shell scripts to help integration testing.
Jean-Christophe Beaupré [Fri, 24 Oct 2014 14:33:41 +0000 (10:33 -0400)]
neo_doxygen: Add shell scripts to help integration testing.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoneo_doxygen: Introduce a tool to import a Doxygen model.
Jean-Christophe Beaupré [Tue, 4 Nov 2014 17:13:46 +0000 (12:13 -0500)]
neo_doxygen: Introduce a tool to import a Doxygen model.

Import the following:

* Classes
* Namespaces
* Inheritance relationships
* Documentation of classes (not formatted yet)

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agostandard: Add tests for `Text.search_last`.
Jean-Christophe Beaupré [Tue, 4 Nov 2014 17:09:15 +0000 (12:09 -0500)]
standard: Add tests for `Text.search_last`.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agomore_collections: Add `DefaultMap`.
Jean-Christophe Beaupré [Tue, 4 Nov 2014 17:12:32 +0000 (12:12 -0500)]
more_collections: Add `DefaultMap`.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agostandard: Add `Text.search_last`.
Jean-Christophe Beaupré [Tue, 4 Nov 2014 17:11:03 +0000 (12:11 -0500)]
standard: Add `Text.search_last`.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoabstract_compiler: use `ExternFiles::pkgconfig` for boehm
Jean Privat [Tue, 4 Nov 2014 16:27:49 +0000 (11:27 -0500)]
abstract_compiler: use `ExternFiles::pkgconfig` for boehm

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoc_tools: add attribute `ExternFile::pkgconfigs` to stores needed libraries.
Jean Privat [Tue, 4 Nov 2014 16:25:34 +0000 (11:25 -0500)]
c_tools: add attribute `ExternFile::pkgconfigs` to stores needed libraries.

Thew will be resolved at the `make` time.

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agocontrib/online_ide: update signature of `compute_nit_dir`
Jean Privat [Tue, 4 Nov 2014 16:13:59 +0000 (11:13 -0500)]
contrib/online_ide: update signature of `compute_nit_dir`

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotests: update sav/test_toolcontext*
Jean Privat [Tue, 4 Nov 2014 13:59:13 +0000 (08:59 -0500)]
tests: update sav/test_toolcontext*

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotoolcontext: hide some really internal options so they do not appears on --help
Jean Privat [Tue, 4 Nov 2014 13:50:28 +0000 (08:50 -0500)]
toolcontext: hide some really internal options so they do not appears on --help

* --bash-completion
* --stub-man
* --set-dummy-tool
* --no-main

These options are still recognized, bash-completed and in the manpage

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotests: with niti put the options before the program
Jean Privat [Tue, 4 Nov 2014 13:39:13 +0000 (08:39 -0500)]
tests: with niti put the options before the program

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agomodelize: 4 -v are needed fo method-level informations
Jean Privat [Tue, 4 Nov 2014 02:50:40 +0000 (21:50 -0500)]
modelize: 4 -v are needed fo method-level informations

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agonit: use OptionContext flag options_before_rest
Jean Privat [Tue, 4 Nov 2014 02:40:50 +0000 (21:40 -0500)]
nit: use OptionContext flag options_before_rest

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agolib/opts: add flag `options_before_rest`
Jean Privat [Tue, 4 Nov 2014 02:40:20 +0000 (21:40 -0500)]
lib/opts: add flag `options_before_rest`

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotoolcontext: re-add --nit-dir option with higer precedence
Jean Privat [Tue, 4 Nov 2014 02:27:31 +0000 (21:27 -0500)]
toolcontext: re-add --nit-dir option with higer precedence

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotoolcontext: nit_dir is non-nullable
Jean Privat [Tue, 4 Nov 2014 02:26:40 +0000 (21:26 -0500)]
toolcontext: nit_dir is non-nullable

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agocompiler: remove --clib-path and NIT_CC_PATH
Jean Privat [Tue, 4 Nov 2014 02:25:21 +0000 (21:25 -0500)]
compiler: remove --clib-path and NIT_CC_PATH

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotoolcontext: make compute_nit_dir more robust
Jean Privat [Tue, 4 Nov 2014 02:11:45 +0000 (21:11 -0500)]
toolcontext: make compute_nit_dir more robust

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoman: rewrite nitg.md
Jean Privat [Mon, 3 Nov 2014 16:21:00 +0000 (11:21 -0500)]
man: rewrite nitg.md

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agonitdoc: Extend the model to help the importation from Doxygen.
Jean-Christophe Beaupré [Mon, 3 Nov 2014 21:35:57 +0000 (16:35 -0500)]
nitdoc: Extend the model to help the importation from Doxygen.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoneo: Really load the graph only once.
Jean-Christophe Beaupré [Mon, 3 Nov 2014 20:43:06 +0000 (15:43 -0500)]
neo: Really load the graph only once.

This cut memory consumption in half (approximately).

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoneo: Load the graph in chunks.
Jean-Christophe Beaupré [Mon, 3 Nov 2014 20:38:01 +0000 (15:38 -0500)]
neo: Load the graph in chunks.

Fix #870.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoMerge: Bugfixes for MacOSX
Jean Privat [Mon, 3 Nov 2014 19:45:05 +0000 (14:45 -0500)]
Merge: Bugfixes for MacOSX

Some hot-bugfixes for MacOSX.

See the individual commits for the details.

Pull-Request: #865
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agoman: add nitc as an alias of nitg
Jean Privat [Mon, 3 Nov 2014 18:38:03 +0000 (13:38 -0500)]
man: add nitc as an alias of nitg

So people that does `man nitc` will see something.

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoREADME: add pkg-config as a requirement
Jean Privat [Mon, 3 Nov 2014 07:51:11 +0000 (02:51 -0500)]
README: add pkg-config as a requirement

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotests: fix saferun() return value when TIME is not set
Jean Privat [Sun, 2 Nov 2014 16:04:28 +0000 (11:04 -0500)]
tests: fix saferun() return value when TIME is not set

Doing stuff after the command execution will temper its return value.

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotoolcontext: nit_dir tries another heuristic on PATH if procfs is not available
Jean Privat [Sun, 2 Nov 2014 16:02:56 +0000 (11:02 -0500)]
toolcontext: nit_dir tries another heuristic on PATH if procfs is not available

procfs (/proc/) does not exists on some system (macosx).
Therefore the heuristic used to find nit_dir will fail on those system
when the command is invoked from the PATH.

The solution is to add another heuristic, where the program_name is
manually searched inside the directories of PATH in order to find the
original directory.

Reported-by: Alexandre Blondin Massé <alexandre.blondin.masse@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

9 years agobin: nitc does no more rely on procfs
Jean Privat [Sun, 2 Nov 2014 16:01:39 +0000 (11:01 -0500)]
bin: nitc does no more rely on procfs

procfs (/proc/) does not exists on some system (macosx).
So use `$BASH_SOURCE` to approximate the original source-file.

Maybe we should just rename back nitg to nitc.

Reported-by: Alexandre Blondin Massé <alexandre.blondin.masse@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotools: use pkg-config to found libgc
Jean Privat [Sat, 1 Nov 2014 18:06:17 +0000 (14:06 -0400)]
tools: use pkg-config to found libgc

In some platform (macosx+macports), the libgc library is not located at
standard default position.
Fortunately, libgc seems to be registered with pkg-config under most
platforms.

Thus, use pkg-config in the generated makefiles to found the correct
flags and paths.

In c_src, some generated files are manually modified to provide a
working bootstrap under those platforms.

This is only a quick-and-dirty workaround. The real job must be polished
and generalized to solve the issue #864.

Reported-by: Alexandre Blondin Massé <alexandre.blondin.masse@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

9 years agodoc: remove advanced_options (deprecated by manpages)
Jean Privat [Mon, 3 Nov 2014 14:52:03 +0000 (09:52 -0500)]
doc: remove advanced_options (deprecated by manpages)

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoman: improve README when people already have a MANPATH
Jean Privat [Mon, 3 Nov 2014 14:51:22 +0000 (09:51 -0500)]
man: improve README when people already have a MANPATH

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agomakefile: add `man` rule to build the manpages
Jean Privat [Mon, 3 Nov 2014 14:49:54 +0000 (09:49 -0500)]
makefile: add `man` rule to build the manpages

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agomodelize: new advice for old-style-init
Jean Privat [Sun, 2 Nov 2014 00:28:37 +0000 (20:28 -0400)]
modelize: new advice for old-style-init

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agolib: use new constructors in some libs used by nit tools
Jean Privat [Sun, 2 Nov 2014 00:26:54 +0000 (20:26 -0400)]
lib: use new constructors in some libs used by nit tools

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agolib: update some modules of standard to new constructors
Jean Privat [Sat, 1 Nov 2014 19:31:40 +0000 (15:31 -0400)]
lib: update some modules of standard to new constructors

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoneo: Correct exportation of a signature.
Jean-Christophe Beaupré [Sat, 1 Nov 2014 15:58:25 +0000 (11:58 -0400)]
neo: Correct exportation of a signature.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoMerge: lib/android: hack to fix new_global_ref
Jean Privat [Sat, 1 Nov 2014 14:32:14 +0000 (10:32 -0400)]
Merge: lib/android: hack to fix new_global_ref

awaiting a fix for #845

@privat This might fix some android apps, ballz at least.

Pull-Request: #846
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agoversion 0.6.10 v0.6.10
Jean Privat [Fri, 31 Oct 2014 12:56:20 +0000 (08:56 -0400)]
version 0.6.10

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoupdate c_src
Jean Privat [Fri, 31 Oct 2014 16:55:06 +0000 (12:55 -0400)]
update c_src

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agolib/android: hacks to fix new_global_ref awaiting a fix for #845
Alexis Laferrière [Fri, 10 Oct 2014 17:44:07 +0000 (13:44 -0400)]
lib/android: hacks to fix new_global_ref awaiting a fix for #845

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoMerge: Distribuable compiledir
Jean Privat [Fri, 31 Oct 2014 11:17:55 +0000 (07:17 -0400)]
Merge: Distribuable compiledir

Unfortunately, Nit is not yet available everywhere.
Therefore, in order to be able to distribute or deploy Nit programs, one easy way is to distribute the generated C code.

This is what we already do with `c_src` that contains modified C code from the compilation of nith.

This PR generalize the approach and allow the compiler to produce some neat and distributable .compile_dir.
Look at the new `mkcsrc` to see how things are simpler now.

Example, you want to disribute `hello_world`:

~~~sh
$ nitg examples/hello_world.nit --semi-global --no-cc --dir hello --compile-dir hello
$ ls -l hello
abstract_collection.sep.0.h
abstract_collection.sep.1.c
array.sep.0.h
array.sep.1.c
c_functions_hash.c
c_functions_hash.h
file_nit.c
file_nit.h
file.sep.0.h
file.sep.1.c
gc_chooser.c
gc_chooser.h
hello_world.classes.0.h
hello_world.classes.1.c
hello_world.main.0.h
hello_world.main.1.c
hello_world.mk
hello_world.sep.0.h
hello_world.sep.1.c
hello_world.types.0.h
hello_world.types.1.c
kernel.sep.0.h
kernel.sep.1.c
Makefile
math_nit.h
math.sep.0.h
math.sep.1.c
nit.common.h
stream.sep.0.h
stream.sep.1.c
string_nit.c
string_nit.h
string.sep.0.h
string.sep.1.c
$ cd hello
$ make
ccache cc -g -O2 -Wno-unused-value -Wno-switch  -c -o hello_world.classes.1.o hello_world.classes.1.c
ccache cc -g -O2 -Wno-unused-value -Wno-switch  -c -o hello_world.main.1.o hello_world.main.1.c
ccache cc -g -O2 -Wno-unused-value -Wno-switch  -c -o hello_world.sep.1.o hello_world.sep.1.c
ccache cc -g -O2 -Wno-unused-value -Wno-switch  -c -o string.sep.1.o string.sep.1.c
ccache cc -g -O2 -Wno-unused-value -Wno-switch  -c -o math.sep.1.o math.sep.1.c
ccache cc -g -O2 -Wno-unused-value -Wno-switch  -c -o kernel.sep.1.o kernel.sep.1.c
ccache cc -g -O2 -Wno-unused-value -Wno-switch  -c -o abstract_collection.sep.1.o abstract_collection.sep.1.c
ccache cc -g -O2 -Wno-unused-value -Wno-switch  -c -o array.sep.1.o array.sep.1.c
ccache cc -g -O2 -Wno-unused-value -Wno-switch  -c -o file.sep.1.o file.sep.1.c
ccache cc -g -O2 -Wno-unused-value -Wno-switch  -c -o stream.sep.1.o stream.sep.1.c
ccache cc -g -O2 -Wno-unused-value -Wno-switch  -c -o hello_world.types.1.o hello_world.types.1.c
ccache cc -g -O2 -Wno-unused-value -Wno-switch  -c -o string_nit.extern.o string_nit.c
ccache cc -g -O2 -Wno-unused-value -Wno-switch  -c -o file_nit.extern.o file_nit.c
ccache cc -g -O2 -Wno-unused-value -Wno-switch  -c -o c_functions_hash.extern.o c_functions_hash.c
ccache cc -g -O2 -Wno-unused-value -Wno-switch -DWITH_LIBGC -c -o gc_chooser.extern.o gc_chooser.c
ccache cc  -o hello_world hello_world.classes.1.o hello_world.main.1.o hello_world.sep.1.o string.sep.1.o math.sep.1.o kernel.sep.1.o abstract_collection.sep.1.o array.sep.1.o file.sep.1.o stream.sep.1.o hello_world.types.1.o string_nit.extern.o file_nit.extern.o c_functions_hash.extern.o gc_chooser.extern.o -lm -lgc  -lunwind
$ ./hello_world
hello world
~~~

Pull-Request: #860

9 years agoMerge: Attribute block
Jean Privat [Fri, 31 Oct 2014 11:17:49 +0000 (07:17 -0400)]
Merge: Attribute block

As promised in #832, here the attribute initialized with a block instead of a simple expression.

The syntax is quite strange but nobody complained in #832.
The final value is returned with a `return` and the `do` block follows optional annotation to look like the definition of methods.

`lazy` and all other annotations on attributes should works as expected.

~~~
class A
   var foo: String do return "Hello"
   var bar: String is lazy do
      return foo + ", world!"
   end
end
var a = new A
print a.bar # => hello, world!
~~~

Pull-Request: #858
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agoMerge: Autoinit attributes
Jean Privat [Fri, 31 Oct 2014 11:17:46 +0000 (07:17 -0400)]
Merge: Autoinit attributes

Allow `autoinit` on attributes.

This means that the initialization of the attribute is done during the initializer phase.
This will help when the initial value of an attribute depend on the value of another attribute set a the initializer phase.

So that

~~~
class A
   var x: String
   var y: String = x + " world!"
end
var a = new A("hello") # BOOM! uninitialized x while initializing y
print a.y
~~~

Can become:

~~~
class A
   var x: String
   var y: String = x + " world!" is autoinit
end
var a = new A("hello")
print a.y # => hello world!
~~~

The inconvenient is that the initialisation markers of attributes become more complex.
Now we have:

* no default value and no special annotation: the setter is collected as an initializer
* no default value and `noinit`: not automatically initialized
* default value and no special annotation: the value is set between the allocation and all initializers
* default value and annotation `lazy`: the value is set at the first access
* *new* default value and annotation `autoinit`: the value is set with all other initializers (other `autoinit`)

For an implementation explanation, the mechanism is a quick hack: `autoinit` means `lazy` + the getter is collector as an initializer. Therefore, when initializers are invoked, the getter will be invoked and the value lazily evaluated.

So the example is equivalent to

~~~
class A
   var x: String
   var y: String = x + " world!" is lazy
end
var a = ALLOCATE(A)
a.x = "hello" # collected setter for x
a.y # lazy getter for y
a.init
print a.y # => hello world!
~~~

Pull-Request: #857
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years ago.gitattributes: nodiff all c_src
Jean Privat [Thu, 30 Oct 2014 01:58:12 +0000 (21:58 -0400)]
.gitattributes: nodiff all c_src

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agomkcsrc: rewrite a simplified version
Jean Privat [Thu, 30 Oct 2014 01:51:57 +0000 (21:51 -0400)]
mkcsrc: rewrite a simplified version

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotests: add base_init_autoinit2.nit
Jean Privat [Wed, 29 Oct 2014 17:25:09 +0000 (13:25 -0400)]
tests: add base_init_autoinit2.nit

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agomodelize: handle `autoinit` on attributes
Jean Privat [Wed, 29 Oct 2014 17:02:37 +0000 (13:02 -0400)]
modelize: handle `autoinit` on attributes

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agosemantize: move noinit attribute to `AAttrPropdef::build_property`
Jean Privat [Wed, 29 Oct 2014 16:58:26 +0000 (12:58 -0400)]
semantize: move noinit attribute to `AAttrPropdef::build_property`

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotests: add base_attr_init_val_block.nit
Jean Privat [Wed, 29 Oct 2014 18:45:08 +0000 (14:45 -0400)]
tests: add base_attr_init_val_block.nit

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agomodelize: introduce `AAttrPropdef::has_value`
Jean Privat [Wed, 29 Oct 2014 16:43:01 +0000 (12:43 -0400)]
modelize: introduce `AAttrPropdef::has_value`

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotools: accept statement block in attributes
Jean Privat [Wed, 29 Oct 2014 18:24:39 +0000 (14:24 -0400)]
tools: accept statement block in attributes

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agocompiler: introduce `AAttrPropdef::evaluate_expr` to factorize the compilation of...
Jean Privat [Wed, 29 Oct 2014 18:16:49 +0000 (14:16 -0400)]
compiler: introduce `AAttrPropdef::evaluate_expr` to factorize the compilation of default values

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoMerge: neo4j: Print an error message when the server is down.
Jean Privat [Fri, 31 Oct 2014 01:58:38 +0000 (21:58 -0400)]
Merge: neo4j: Print an error message when the server is down.

Show the message as expected.

Pull-Request: #861
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agoMerge: Tweaks to Opportunity
Jean Privat [Fri, 31 Oct 2014 01:58:30 +0000 (21:58 -0400)]
Merge: Tweaks to Opportunity

Prettier forms and other modifications for your consideration.

I will deploy it on a server later today or tomorrow.

Pull-Request: #859
Reviewed-by: Jean Privat <jean@pryen.org>

9 years agolib/android: hacks to fix new_global_ref awaiting a fix for #845
Alexis Laferrière [Fri, 10 Oct 2014 17:44:07 +0000 (13:44 -0400)]
lib/android: hacks to fix new_global_ref awaiting a fix for #845

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoxymus.net: opportunity use site's header
Alexis Laferrière [Wed, 29 Oct 2014 23:10:14 +0000 (19:10 -0400)]
xymus.net: opportunity use site's header

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoxymus.net: update xymus.net nitcorn config to include an opportunity client
Alexis Laferrière [Wed, 29 Oct 2014 21:59:13 +0000 (17:59 -0400)]
xymus.net: update xymus.net nitcorn config to include an opportunity client

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoopportunity: always show at least 5 answer fields
Alexis Laferrière [Thu, 30 Oct 2014 14:58:58 +0000 (10:58 -0400)]
opportunity: always show at least 5 answer fields

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoopportunity: nicer meetup creation confirmation
Alexis Laferrière [Thu, 30 Oct 2014 12:05:16 +0000 (08:05 -0400)]
opportunity: nicer meetup creation confirmation

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoopportunity: improve look of welcome message
Alexis Laferrière [Thu, 30 Oct 2014 11:54:22 +0000 (07:54 -0400)]
opportunity: improve look of welcome message

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoopportunity: restrict modification of old entries
Alexis Laferrière [Wed, 29 Oct 2014 23:30:57 +0000 (19:30 -0400)]
opportunity: restrict modification of old entries

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoopportunity: use a container in "meetup" and "meetup_confirmation"
Alexis Laferrière [Wed, 29 Oct 2014 23:07:31 +0000 (19:07 -0400)]
opportunity: use a container in "meetup" and "meetup_confirmation"

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoopportunity: meetups hash also rely on timestamp
Alexis Laferrière [Wed, 29 Oct 2014 21:53:59 +0000 (17:53 -0400)]
opportunity: meetups hash also rely on timestamp

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoopportunity: support not being at web server root
Alexis Laferrière [Wed, 29 Oct 2014 21:52:11 +0000 (17:52 -0400)]
opportunity: support not being at web server root

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoopportunity: by default the server uses port 8080
Alexis Laferrière [Wed, 29 Oct 2014 20:12:01 +0000 (16:12 -0400)]
opportunity: by default the server uses port 8080

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoopportunity: prettier meetup participation form
Alexis Laferrière [Wed, 29 Oct 2014 20:11:32 +0000 (16:11 -0400)]
opportunity: prettier meetup participation form

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoopportunity: prettier meetup creation
Alexis Laferrière [Wed, 29 Oct 2014 20:11:04 +0000 (16:11 -0400)]
opportunity: prettier meetup creation

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoneo4j: Print an error message when the server is down.
Jean-Christophe Beaupré [Wed, 29 Oct 2014 18:54:03 +0000 (14:54 -0400)]
neo4j: Print an error message when the server is down.

Show the message as expected.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agocompile: also generates a makefile named Makefile
Jean Privat [Thu, 30 Oct 2014 01:32:37 +0000 (21:32 -0400)]
compile: also generates a makefile named Makefile

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agocompile: add option --group-c-files
Jean Privat [Thu, 30 Oct 2014 01:22:57 +0000 (21:22 -0400)]
compile: add option --group-c-files

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agocompile: remove clib from the -I dir because the usufull files are already copied
Jean Privat [Thu, 30 Oct 2014 01:11:03 +0000 (21:11 -0400)]
compile: remove clib from the -I dir because the usufull files are already copied

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agocompile: use shortest path from the compiledir to the outname
Jean Privat [Thu, 30 Oct 2014 00:55:15 +0000 (20:55 -0400)]
compile: use shortest path from the compiledir to the outname

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agocompiler: add option --max-c-lines
Jean Privat [Thu, 30 Oct 2014 00:47:21 +0000 (20:47 -0400)]
compiler: add option --max-c-lines

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agocompiler: do not create empty .h file
Jean Privat [Thu, 30 Oct 2014 00:36:49 +0000 (20:36 -0400)]
compiler: do not create empty .h file

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoopportunity: accept meetup without date or location
Alexis Laferrière [Wed, 29 Oct 2014 20:10:43 +0000 (16:10 -0400)]
opportunity: accept meetup without date or location

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoMerge: Threads
Jean Privat [Wed, 29 Oct 2014 19:11:53 +0000 (15:11 -0400)]
Merge: Threads

Intro the `threads` module with support for POSIX threads, mutex and barriers. Also provides 2 ways to have thread-safe collections: refining existing collections and sub-classing them.

TODO:
* Complete the collection support.
* Modifiy `print` so that printing the user content and the new line is (generally) atomic
* Add more examples/use in real programs
* Reinforce error support.
* Fix compatibility with FFI's global refs.
* Add, when needed, GC_THREADS to `gc_chooser.[c|h]`
* Do not include `gc.h` when not using libgc

ping @egagnon

Pull-Request: #849
Reviewed-by: Jean-Philippe Caissy <jpcaissy@piji.ca>
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Etienne M. Gagnon <egagnon@j-meg.com>

9 years agoMerge: neo4j: Implement missing methods in `JsonArray`.
Jean Privat [Wed, 29 Oct 2014 19:11:45 +0000 (15:11 -0400)]
Merge: neo4j: Implement missing methods in `JsonArray`.

Pull-Request: #856
Reviewed-by: Jean Privat <jean@pryen.org>

9 years agoMerge: Workaround nitlight
Jean Privat [Wed, 29 Oct 2014 19:11:41 +0000 (15:11 -0400)]
Merge: Workaround nitlight

nitlight was broken when `is cached` was used because highlight does not like AST transtormations.

This workaround justs disable the `cache` phase until something better is found.

http://nitlanguage.org/code2/nitserial.html#nitserial#MModule#serializable_type

Pull-Request: #855
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agoMerge: lib: fix semantic on has_substring on extreme cases
Jean Privat [Wed, 29 Oct 2014 19:11:38 +0000 (15:11 -0400)]
Merge: lib: fix semantic on has_substring on extreme cases

And avoid illegal access outside the string.

Detected thanks to the interpreted that warns on out-of-bound accesses in nativestrings.

Pull-Request: #854
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agolib/threads: intro an example `concurrent_array_and_barrier`
Alexis Laferrière [Mon, 27 Oct 2014 14:40:51 +0000 (10:40 -0400)]
lib/threads: intro an example `concurrent_array_and_barrier`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agolib/threads: intro new thread-safe concurrent collections
Alexis Laferrière [Sun, 26 Oct 2014 16:23:11 +0000 (12:23 -0400)]
lib/threads: intro new thread-safe concurrent collections

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>