NiTypesin?
NiStructures?
NiExpressions?
NiIdentifiers?
NiOptimisations?
(So what is this Ni then? A compiled Python?)
(If so, do you know about Pyrex? --GlynWebster)
Partially, Ni also has a few other goals. One of the major ones is that programmers introduce bugs, usually at a constant rate per line of code written. By reducing the amount of programming a programmer has to do, and using the compiler to try and detect bugs earlier, more reliable programs can be written. Ni attempts to do this by:
would automatically have the precondition added that i!=0. Thus, if a call is made to foo() where i may be "0", a warning will be generated at compile time. The compiler can also use this information to optimise the program. For instance, foo() above has no side effects, and depends on no other information other than i, therefore it's result can be cached, precomputed, and/or hoisted out of a loop.
Looking at the code generated by the compiler, it was unable to make use of these comments/assertions for optimisation, nor was it able to warn me if I called this function with a constant NULL. Another example in all the m_.c files in ircu, there is a short note mentioning that in the m_ functions, sptr==cptr. The compiler is unable to make use of this hint and will reload all the elements of the structures these point to when the other one changes, not realising that they can be optimised and only loaded once.
array [? of string data;
data.sort()
Now, the only used methods are insertSorted() and data.pop(), so the "best" implementation of this would be a PriorityQueue, the memory ca n be statically allocated at 10 items, since we know at compile time that that is the maximum size of the heap.
This leaves the programmer free from having to think about datastructures and just thinking about the "business logic" of their program.
No other page links to LanguageNi yet.