remove unmaintained documentation: developpez and nitreference
authorJean Privat <jean@pryen.org>
Thu, 17 Jul 2014 14:12:38 +0000 (10:12 -0400)
committerJean Privat <jean@pryen.org>
Thu, 17 Jul 2014 14:12:38 +0000 (10:12 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

102 files changed:
doc/README
doc/developpez/doc_nit.cls [deleted file]
doc/developpez/licence.tex [deleted file]
doc/developpez/modules/listings/array1_c.nit [deleted file]
doc/developpez/modules/listings/array2_c.nit [deleted file]
doc/developpez/modules/listings/cos1_c.nit [deleted file]
doc/developpez/modules/listings/exp1_c.nit [deleted file]
doc/developpez/modules/listings/hashmap1_c.nit [deleted file]
doc/developpez/modules/listings/iterator1_s.nit [deleted file]
doc/developpez/modules/listings/list1_c.nit [deleted file]
doc/developpez/modules/listings/pi1_c.nit [deleted file]
doc/developpez/modules/listings/set1_c.nit [deleted file]
doc/developpez/modules/listings/sorter1_c.nit [deleted file]
doc/developpez/modules/modules.tex [deleted file]
doc/developpez/nit.tex [deleted file]
doc/developpez/poo/listings/abstract1_c.nit [deleted file]
doc/developpez/poo/listings/abstract2_c.nit [deleted file]
doc/developpez/poo/listings/accesseurs1_c.nit [deleted file]
doc/developpez/poo/listings/accesseurs2_c.nit [deleted file]
doc/developpez/poo/listings/accesseurs3_c.nit [deleted file]
doc/developpez/poo/listings/accesseurs4_c.nit [deleted file]
doc/developpez/poo/listings/attribut1_c.nit [deleted file]
doc/developpez/poo/listings/attribut2_c.nit [deleted file]
doc/developpez/poo/listings/coercition1_c.nit [deleted file]
doc/developpez/poo/listings/coercition2_s.nit [deleted file]
doc/developpez/poo/listings/comparaison1_s.nit [deleted file]
doc/developpez/poo/listings/comparaison2_c.nit [deleted file]
doc/developpez/poo/listings/constructeur1_c.nit [deleted file]
doc/developpez/poo/listings/constructeur2_c.nit [deleted file]
doc/developpez/poo/listings/constructeur3_c.nit [deleted file]
doc/developpez/poo/listings/constructeur4_c.nit [deleted file]
doc/developpez/poo/listings/gen1_c.nit [deleted file]
doc/developpez/poo/listings/gen2_c.nit [deleted file]
doc/developpez/poo/listings/gen3_c.nit [deleted file]
doc/developpez/poo/listings/gen4_s.nit [deleted file]
doc/developpez/poo/listings/gen5_c.nit [deleted file]
doc/developpez/poo/listings/heritage1_s.nit [deleted file]
doc/developpez/poo/listings/import1_c.nit [deleted file]
doc/developpez/poo/listings/interface_c.nit [deleted file]
doc/developpez/poo/listings/isset_c.nit [deleted file]
doc/developpez/poo/listings/methode1_c.nit [deleted file]
doc/developpez/poo/listings/methode2_c.nit [deleted file]
doc/developpez/poo/listings/methode4_s.nit [deleted file]
doc/developpez/poo/listings/methode5_c.nit [deleted file]
doc/developpez/poo/listings/methode6_c.nit [deleted file]
doc/developpez/poo/listings/methode7_c.nit [deleted file]
doc/developpez/poo/listings/methode8_c.nit [deleted file]
doc/developpez/poo/listings/methode9_c.nit [deleted file]
doc/developpez/poo/listings/new1_s.nit [deleted file]
doc/developpez/poo/listings/new2_s.nit [deleted file]
doc/developpez/poo/listings/new3_s.nit [deleted file]
doc/developpez/poo/listings/nullable1_c.nit [deleted file]
doc/developpez/poo/listings/package1_c.nit [deleted file]
doc/developpez/poo/listings/polymorphisme1_c.nit [deleted file]
doc/developpez/poo/listings/polymorphisme_c.nit [deleted file]
doc/developpez/poo/listings/redef1_c.nit [deleted file]
doc/developpez/poo/listings/redef2_c.nit [deleted file]
doc/developpez/poo/listings/redef3_c.nit [deleted file]
doc/developpez/poo/listings/redef4_c.nit [deleted file]
doc/developpez/poo/listings/redef5_c.nit [deleted file]
doc/developpez/poo/listings/self_c.nit [deleted file]
doc/developpez/poo/listings/super1_c.nit [deleted file]
doc/developpez/poo/listings/super2_c.nit [deleted file]
doc/developpez/poo/listings/super3_c.nit [deleted file]
doc/developpez/poo/listings/type1_c.nit [deleted file]
doc/developpez/poo/listings/type2_c.nit [deleted file]
doc/developpez/poo/listings/type3_s.nit [deleted file]
doc/developpez/poo/listings/type4_s.nit [deleted file]
doc/developpez/poo/listings/type5_s.nit [deleted file]
doc/developpez/poo/listings/type6_s.nit [deleted file]
doc/developpez/poo/poo.tex [deleted file]
doc/developpez/presentation/listings/hello_world_s.nit [deleted file]
doc/developpez/presentation/presentation.tex [deleted file]
doc/developpez/syntaxe/listings/array2_c.nit [deleted file]
doc/developpez/syntaxe/listings/array_c.nit [deleted file]
doc/developpez/syntaxe/listings/assert_c.nit [deleted file]
doc/developpez/syntaxe/listings/break_c.nit [deleted file]
doc/developpez/syntaxe/listings/char1_c.nit [deleted file]
doc/developpez/syntaxe/listings/chariot_s.nit [deleted file]
doc/developpez/syntaxe/listings/comment_s.nit [deleted file]
doc/developpez/syntaxe/listings/continue_c.nit [deleted file]
doc/developpez/syntaxe/listings/declaration_s.nit [deleted file]
doc/developpez/syntaxe/listings/do_c.nit [deleted file]
doc/developpez/syntaxe/listings/for_c.nit [deleted file]
doc/developpez/syntaxe/listings/if_c.nit [deleted file]
doc/developpez/syntaxe/listings/label_c.nit [deleted file]
doc/developpez/syntaxe/listings/loop_c.nit [deleted file]
doc/developpez/syntaxe/listings/new_s.nit [deleted file]
doc/developpez/syntaxe/listings/nullable_c.nit [deleted file]
doc/developpez/syntaxe/listings/string2_c.nit [deleted file]
doc/developpez/syntaxe/listings/string3_c.nit [deleted file]
doc/developpez/syntaxe/listings/string4_c.nit [deleted file]
doc/developpez/syntaxe/listings/string_c.nit [deleted file]
doc/developpez/syntaxe/listings/typage2_c.nit [deleted file]
doc/developpez/syntaxe/listings/typage3_c.nit [deleted file]
doc/developpez/syntaxe/listings/typage_c.nit [deleted file]
doc/developpez/syntaxe/listings/var_c.nit [deleted file]
doc/developpez/syntaxe/listings/while_c.nit [deleted file]
doc/developpez/syntaxe/syntaxe.tex [deleted file]
doc/nitreference/nitlanguage.sty [deleted file]
doc/nitreference/nitreference-main.tex [deleted file]
doc/nitreference/nitreference.tex [deleted file]

index 6b4c50a..0e23e6a 100644 (file)
@@ -1,8 +1,6 @@
 This directory contains various documentation for Nit
 
 * advanced_options [TXT]: documentation for advanced options of the compiler and run-time execution.
-* developpez [LaTeX/PDF]: a French documentation "Développez en Nit". 
-* nitreference [LaTeX/PDF]: the Nit language reference.
 * stdlib [HTML]: Autodocumentation for the Nit standard library.
 
-
+For more documentation, visit http://nitlanguage.org/doc/
diff --git a/doc/developpez/doc_nit.cls b/doc/developpez/doc_nit.cls
deleted file mode 100644 (file)
index 104525b..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{doc_nit}[2011/01/17 1.0 Format LaTeX pour doc NIT.]
-\LoadClass{report}
-
-% Chargement des extensions
-\usepackage{color} % Gestion des couleurs
-\usepackage{listings} % Gestion du code
-\usepackage{multicol} % Gestion multi-colonne
-\usepackage[pdfborder={0 0 0}, colorlinks=true]{hyperref} % Liens hyper texte
-\usepackage{tabularx} % Tableaux améliorés
-\usepackage[latin1]{inputenc} % Prise en compte de l'UTF-8
-\usepackage[T1]{fontenc}
-\usepackage[francais]{babel} %Traduction en français des Ã©léments chapitres, sections...
-%\usepackage[autolanguage]{numprint}
-\usepackage{graphicx}
-%\usepackage{textcomp}
-%\usepackage[french]{varioref}
-\usepackage{url}
-%\usepackage{moreverb}
-
-% Définition des couleurs
-\definecolor{code_background}{RGB}{239, 255, 188}
-\definecolor{code_border}{RGB}{122, 193, 39}
-
-% Marges
-\setlength{\oddsidemargin}{0cm}      % 4cm left margin
-\setlength{\evensidemargin}{0cm}
-\setlength{\topmargin}{0cm}           % 4cm top margin
-\setlength{\textwidth}{16cm}          % 6.0in text - 1.25in rt margin
-\setlength{\textheight}{21cm} % Body ht for 1in margins 
-
-% Mise forme des paragraphes
-\setlength{\parindent}{0.0in}
-\setlength{\parskip}{0.1in}
-
-% Mise en forme des chapitres
-
-% Mise en forme des listings
-\lstdefinelanguage{Nit}
-{morekeywords={package,import, class,abstract,interface,universal,special,end,fun,type,init,redef,is,do,
-      readable,writable,var,intern,extern,protected,private,intrude,if,then,else,while,loop,for,in,and,or,not,
-      return,continue,break,abort,assert,new,isa,once,super,self,true,false,null,as,nullable,isset,label,print},
-  sensitive=true,
-  morecomment=[l]\#,
-  morestring=[b]",
-  morestring=[b]',
-  basicstyle=\small,
-}
-\lstset{language=Nit,
-  numbers=left,
-  numberstyle=\tiny,    %font size
-  stepnumber=1,
-  numbersep=15pt,
-  backgroundcolor=\color{code_background},
-  rulecolor=\color{code_border},
-  frame=leftline,
-  framerule=3pt,  
-  framexleftmargin=-5pt,
-  xleftmargin=25pt,
-  framesep=15pt,
-  showspaces=false,
-  showstringspaces=false, 
-  showtabs=false,
-  tabsize=2,                % sets default tabsize to 2 spaces
-  breaklines=true,          % sets automatic line breaking
-  breakatwhitespace=false   % sets if automatic breaks should only happen at whitespace
-}
-
-% Macro de lstinline
-\lstMakeShortInline[language=Nit]|
-
-% Environnement Warning TODO
-\newenvironment{warn}
-{\setlength{\parindent}{0.0in}}
-{}
-
diff --git a/doc/developpez/licence.tex b/doc/developpez/licence.tex
deleted file mode 100644 (file)
index 4e64fe6..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-\chapter*{Annexe A : GNU Free Documentation Licence}
-
-Version 1.1, March 2000
-
-Copyright (C) 2000 Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-0. PREAMBLE
-The purpose of this License is to make a manual, textbook, or other written document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.
-
-This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. 
-
-We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.
-
-1. APPLICABILITY AND DEFINITIONS
-This License applies to any manual or other work that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you".
-
-A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.
-
-A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (For example, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.
-
-The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License.
-
-The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License.
-
-A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, whose contents can be viewed and edited directly and straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup has been designed to thwart or discourage subsequent modification by readers is not Transparent. A copy that is not "Transparent" is called "Opaque".
-
-Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML designed for human modification. Opaque formats include PostScript, PDF, proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML produced by some word processors for output purposes only.
-
-The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text.
-
-2. VERBATIM COPYING
-You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section COPYIN IN QUANTITY.
-
-You may also lend copies, under the same conditions stated above, and you may publicly display copies.
-
-3. COPYING IN QUANTITY
-If you publish printed copies of the Document numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.
-
-If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as it reasonably) on the actual cover, and continue the rest onto adjacent pages. 
-
-If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a publicly-accessible computer-network location containing a complete Transparent copy of the Document, free of added material, which the general network-using public has access to download anonymously at no charge using public-standard network protocols. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.
-
-It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.
-
-4. MODIFICATIONS
-You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:
-
-A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.
-
-B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has less than five).
-
-C. State on the Title page the name of the publisher of the Modified Version, as the publisher.
-
-D. Preserve all the copyright notices of the Document.
-
-E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.
-
-F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.
-
-G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice.
-
-H. Include an unaltered copy of this License.
-
-I. Preserve the section entitled "History", and its title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.
-
-J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.
-
-K. In any section entitled "Acknowledgements" or "Dedications", preserve the section's title, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.
-
-L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.
-
-M. Delete any section entitled "Endorsements". Such a section may not be included in the Modified Version.
-
-N. Do not retitle any existing section as "Endorsements" or to conflict in title with any Invariant Section.
-
-If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles.
-
-You may add a section entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative définition of a standard.
-
-You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.
-
-The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.
-
-5. COMBINING DOCUMENTS
-You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice.
-
-The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.
-
-In the combination, you must combine any sections entitled "History" in the various original documents, forming one section entitled "History"; likewise combine any sections entitled "Acknowledgements", and any sections entitled "Dedications". You must delete all sections entitled "Endorsements."
-
-6. COLLECTIONS OF DOCUMENTS
-You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.
-
-You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.
-
-7. AGGREGATION WITH INDEPENDENT WORKS
-A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, does not as a whole count as a Modified Version of the Document, provided no compilation copyright is claimed for the compilation. Such a compilation is called an "aggregate", and this License does not apply to the other self-contained works thus compiled with the Document, on account of their being thus compiled, if they are not themselves derivative works of the Document.
-
-If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one quarter of the entire aggregate, the Document's Cover Texts may be placed on covers that surround only the Document within the aggregate. Otherwise they must appear on covers around the whole aggregate.
-
-8. TRANSLATION
-Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License provided that you also include the original English version of this License. In case of a disagreement between the translation and the original English version of this License, the original English version will prevail.
-
-10. TERMINATION
-You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
-
-11. FUTURE REVISIONS OF THIS LICENSE
-The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/.
-
-Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation.
\ No newline at end of file
diff --git a/doc/developpez/modules/listings/array1_c.nit b/doc/developpez/modules/listings/array1_c.nit
deleted file mode 100644 (file)
index 9eb67d6..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-var array = new Array[String]
-
-array.enlarge(100) # Agrandie le tableau avant un ajout massif
-
-var i = 0
-while i < 100 do
-       array[i] = "toto"
-       i+=1
-end
diff --git a/doc/developpez/modules/listings/array2_c.nit b/doc/developpez/modules/listings/array2_c.nit
deleted file mode 100644 (file)
index f962720..0000000
+++ /dev/null
@@ -1 +0,0 @@
-var array = new Array[String].with_capacity(100)
diff --git a/doc/developpez/modules/listings/cos1_c.nit b/doc/developpez/modules/listings/cos1_c.nit
deleted file mode 100644 (file)
index 0ddfa37..0000000
+++ /dev/null
@@ -1 +0,0 @@
-print "Cos de 1 radian : " + 1.0.cos.to_s #0.540302
diff --git a/doc/developpez/modules/listings/exp1_c.nit b/doc/developpez/modules/listings/exp1_c.nit
deleted file mode 100644 (file)
index efceed0..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-print "5 au cube : " + 5.0.pow(3.0).to_s #125.0
-print "Racine carrée de 25 : " + 25.0.sqrt.to_s #5.0
-print "Exponentielle de 5 : " + 5.0.exp.to_s #148.413162
diff --git a/doc/developpez/modules/listings/hashmap1_c.nit b/doc/developpez/modules/listings/hashmap1_c.nit
deleted file mode 100644 (file)
index 62bafcf..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# On enregistre les notes des Ã©tudiants dans une HashMap
-var notes = new HashMap[String, Int] #(String : Code Etudiant, Int : Note)
-
-notes["ATE1234"] = 12
-notes["BRE2345"] = 13
-notes["RUY3456"] = 9
-notes["FIO4567"] = 10
-notes["XUH5678"] = 16
-notes["COP6789"] = 6
-
-# Affiche une note
-print "Note de l'étudiant BRE2345 : {notes["BRE2345"]}"
-
-# Calcule la moyenne
-var somme = 0
-
-for note in notes do
-       somme += note   
-end
-
-var moyenne = somme / notes.length
-
-print "Moyenne de la classe : {moyenne}"
diff --git a/doc/developpez/modules/listings/iterator1_s.nit b/doc/developpez/modules/listings/iterator1_s.nit
deleted file mode 100644 (file)
index e4caa4b..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-var iterator = collection.iterator
-
-while iterator.is_ok do
-       print iterator.item
-       iterator.next
-end
diff --git a/doc/developpez/modules/listings/list1_c.nit b/doc/developpez/modules/listings/list1_c.nit
deleted file mode 100644 (file)
index 2596c9d..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-var list = new List[Int] #Instancie une nouvelle liste
-list.push(1) #Ajoute l'élément Ã  la fin de la liste
-list.push(2) #Ajoute l'élément Ã  la fin de la liste
-list.push(3) #Ajoute l'élément Ã  la fin de la liste
-
-print list.is_empty #false : la liste n'est pas vide
-
-print list[1] #2 : Affiche l'élément Ã  l'index 2 (sans le retirer)
-
-print list.pop #3 : Retourne le dernier Ã©lément et le retire de la liste
-print list.pop #2 : Retourne le dernier Ã©lément et le retire de la liste
-print list.pop #1 : Retourne le dernier Ã©lément et le retire de la liste
-
-print list.is_empty #true : la liste est vide
diff --git a/doc/developpez/modules/listings/pi1_c.nit b/doc/developpez/modules/listings/pi1_c.nit
deleted file mode 100644 (file)
index 1dd0e1b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-print pi
diff --git a/doc/developpez/modules/listings/set1_c.nit b/doc/developpez/modules/listings/set1_c.nit
deleted file mode 100644 (file)
index 359717d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-var set = new ArraySet[String]
-var a = "Coucou"
-var b = "Coucou"
-
-set.add(a)
-print set.has(b) # true : le set contient déjà la chaîne "Coucou"
diff --git a/doc/developpez/modules/listings/sorter1_c.nit b/doc/developpez/modules/listings/sorter1_c.nit
deleted file mode 100644 (file)
index 30a6c11..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-var tab = ["a", "c", "b"] # Un tableau non trié
-
-print tab # acb
-
-var sorter = new ComparableSorter[String] # On instancie le sorter ComparableSorter en précisant le type que l'on veut trier, ici des String
-
-sorter.sort(tab) # On trie le tableau
-
-print tab # abc
diff --git a/doc/developpez/modules/modules.tex b/doc/developpez/modules/modules.tex
deleted file mode 100644 (file)
index d08ad2a..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-\part{Modules de la bibliothèque standard Nit}
-
-\chapter{Kernel}
-Le module |kernel| est Ã  la base de toute la hiérarchie objet de Nit, c'est donc un module de base. Par exemple, il contient les classes fondamentales telles que |Bool|, |Char|, |Float|, |Int|, |Object|...
-
-Faisons un tour rapide des classes principales du module |kernel| :
-\begin{description}
-    \item[Object]C'est la super classe implicite de toutes les classes en Nit : toutes ces méthodes sont donc héritées par toutes les classes.
-    \item[Bool]Représente les booléens. Les seules instances possibles de cette classe sont |true| et |false|. Les booléens sont souvent utilisés dans les branchements conditionnels et les boucles.
-    \item[Char]Représente les caractères.
-    \item[Comparable]C'est l'ancêtre de toutes les classes dont les instances peuvent Ãªtre comparées selon un ordre total.
-    \item[Discrete]L'ancêtre de toutes les classes représentant des ensembles dénombrables comme les entiers ou l'alphabet.
-    \item[Float]Représente les nombres Ã  virgule flottante.
-    \item[Int]Représente les nombres entiers.
-\end{description}
-
-Les classes du module |kernel| sont fréquemment raffinées dans les autres modules de la bibliothèque standard.
-
-\chapter{String}
-Ce module introduit les classes permettant de manipuler les chaînes de caractères.
-
-La classe principale du module string est |String|.
-
-Le module string raffine les classes |Array|, |Collection|, |Float|, |Int|, |Map| et |Object| pour y rajouter la méthode |to_s|.
-
-\chapter{Maths}
-Le module math raffine les classes Object, Int et Float pour y rajouter une série de méthodes en rapport avec les mathématiques. Elle est automatiquement importée avec la bibliothèque standard.
-
-\section{Variables mathématiques}
-Le module math raffine la classes Object pour lui rajouter la méthode |pi| (3.141592) :
-\lstinputlisting[language=Nit]{./modules/listings/pi1_c.nit}
-
-\section{Fonctions trigonométriques}
-Les méthodes sin(), cos(), tan(), asin(), acos(), atan() permettent d'effectuer les opérations trigonométriques. Les angles doivent Ãªtre exprimés en radians. Pour convertir des degrés en radian, il suffit de les multiplier par pi/180.
-
-Exemple :
-\lstinputlisting[language=Nit]{./modules/listings/cos1_c.nit}
-
-\section{Exponentielles et puissances}
-Les méthodes |pow|, |exp| et |sqrt| permettent de calculer des puissances, des exponentielles et des racines carrées.
-
-Exemple :
-\lstinputlisting[language=Nit]{./modules/listings/exp1_c.nit}
-
-\chapter{Collections}
-Les collections sont des objets qui permettent de gérer des ensembles d'objets. Ces ensembles de données peuvent Ãªtre définis avec plusieurs caractéristiques : la possibilité de gérer des doublons, de gérer un ordre de tri, etc. Chaque objet contenu dans une collection est appelé un Ã©lément.
-
-Les collections sont basées sur le principe de la généricité que nous avons déjà abordé.
-
-\section{Interfaces des collections}
-\subsection{Interface Collection}
-Cette interface définit des méthodes pour des objets qui gèrent des Ã©léments d'une façon assez générale. Elle est la super interface de plusieurs interfaces de la bibliothèque standard. Plusieurs classes qui gèrent une collection implémentent une interface qui hérite de l'interface Collection.
-
-Cette interface définit plusieurs méthodes :
-
-\begin{tabularx}{\linewidth}{|c|X|}
-    \hline
-    Méthode & Rôle \\
-    \hline
-    count(E):Int & Nombre d'occurrence d'un Ã©lément dans une collection. \\
-    \hline
-    has(E):Bool & Vérifie si un Ã©lément se trouve dans la collection. \\
-    \hline
-    has\_only(E):Bool & Vérifie si la collection contient seulement l'élément précisé. \\
-    \hline   
-    is\_empty:Bool & Vérifie si la collection est vide. \\
-    \hline
-    iterate & Itère sur chaque Ã©lément de la collection. \\
-    \hline
-    iterator:Iterator[E] & Retourne un itérateur associé Ã  la collection. \\
-    \hline
-    length & Retourne le nombre d'élément contenu dans la collection. \\
-    \hline
-\end{tabularx}
-
-Cette interface représente un minimum commun pour les objets qui gèrent des collections.
-
-\subsection{Interface Iterator}
-Cette interface définit des méthodes pour des objets capables de parcourir les données d'une collection :
-
-\begin{tabularx}{\linewidth}{|c|X|}
-    \hline
-    Méthode & Rôle \\
-    \hline
-    is\_ok & Indique s'il reste au moins un Ã©lément Ã  parcourir dans la collection. \\
-    \hline
-    item & Renvoie l'élément courant de la collection.  \\
-    \hline
-    next & Saute au prochain Ã©lément de la collection. \\
-    \hline
-\end{tabularx}
-
-Un exemple d'utilisation de l'iterator :
-\lstinputlisting[language=Nit]{./modules/listings/iterator1_s.nit}
-
-\subsection{Interface RemovableCollection}
-Cette interface introduit des méthodes permettant de retirer des Ã©léments d'une collection :
-
-\begin{tabularx}{\linewidth}{|c|X|}
-    \hline
-    Méthode & Rôle \\
-    \hline
-    clear & Retire tous les Ã©léments de la collection. \\
-    \hline
-    remove(E) & Retire l'élément précisé de la collection.  \\
-    \hline
-    remove\_all(E) & Retire toutes les occurrences de l'élément précisé de la collection. \\
-    \hline
-\end{tabularx}
-
-\subsection{Interface SimpleCollection}
-Cette interface introduit des méthodes permettant d'ajouter des Ã©léments dans une collection :
-
-\begin{tabularx}{\linewidth}{|c|X|}
-    \hline
-    Méthode & Rôle \\
-    \hline
-    add(E) & Ajoute l'élément dans la collection. \\
-    \hline
-    add\_all(Collection[E]) & Ajoute tous les Ã©léments dans la collection. \\
-    \hline
-\end{tabularx}
-
-\section{Séquences}
-Les séquences sont des collections indexées et ordonnées. La notion d'index est importante, elle précise que chaque valeur est associée Ã  une sorte d'étiquette numérique permettant de la retrouver. L'ordre de la séquence est donc induit par l'ordre des Ã©tiquettes.
-
-L'interface Sequence introduit les méthodes suivantes :
-
-\begin{tabularx}{\linewidth}{|c|X|}
-    \hline
-    Méthode & Rôle \\
-    \hline
-    append(Collection[E]) & Ajoute tous les Ã©léments de la collection passée en paramètre Ã  la fin de la séquence. \\
-    \hline
-    first:E & Retourne le premier Ã©lément de la séquence. \\
-    \hline
-    first=(E) & Définit le premier Ã©lément de la séquence. \\
-    \hline
-    last:E & Retourne le dernier Ã©lément de la séquence. \\
-    \hline    
-    last=(E) & Définit le dernier Ã©lément de la séquence. \\
-    \hline
-    pop:E & Retourne et retire le dernier Ã©lément de la séquence. \\
-    \hline
-    push(E) & Ajoute l'élément Ã  la fin de la séquence. \\
-    \hline
-    shift:E & Retourne et retire le premier Ã©lément de la séquence. \\ 
-    \hline
-    unshift(E) & Ajoute l'élément au début de la séquence. \\
-    \hline
-\end{tabularx}
-
-L'interface Sequence est implémentée par les tableaux et les listes.
-
-\subsection{Listes}
-Les listes sont des Collections qui autorisent des doublons dans les Ã©léments de la liste, elle acceptent aussi des Ã©léments |null|. Les listes Ã©tant aussi des séquences, elles sont donc indexées et ordonnées, un Ã©lément de la liste peut donc Ãªtre accédé directement Ã  partir de son index. C'est aussi une implémentation concrète de Séquence, elle peut donc Ãªtre instanciée et utilisée directement.
-
-La classe liste représente une liste doublement chaînée : l'ajout d'un Ã©lément peut se faire seulement au début ou Ã  la fin de la collection.
-
-Voici un exemple d'utilisation d'une liste :
-\lstinputlisting[language=Nit]{./modules/listings/list1_c.nit}
-
-\subsection{Tableaux}
-Les tableaux représentent des collections d'objets dont la taille est dynamique. Les tableaux sont gérés grâce Ã  la classe Array.
-
-Chaque objet de type Array gère une capacité qui est le nombre total d'éléments qu'il est possible d'insérer avant d'agrandir le tableau. Cette capacité a donc une relation avec le nombre d'éléments contenus dans la collection. Lors d'un ajout dans la collection, cette capacité et le nombre d'éléments de la collection déterminent si le tableau doit Ãªtre agrandi. Si un nombre important d'éléments doit Ãªtre ajouté, il est possible de forcer l'agrandissement de cette capacité avec la méthode |enlarge|. Son usage Ã©vite une perte de temps liée au recalcul de la taille de la collection. 
-
-Exemple :
-\lstinputlisting[language=Nit]{./modules/listings/array1_c.nit}
-
-Un constructeur permet de préciser la capacité initiale :
-\lstinputlisting[language=Nit]{./modules/listings/array2_c.nit}
-
-\section{Ensembles}
-Un ensemble (Set) est une collection qui n'autorise pas la présence de doublons.
-
-L'interface Set définit les méthodes d'une collection qui n'accepte pas de doublons dans ces Ã©léments. Elle hérite de l'interface Collection mais elle ne définit pas de nouvelle méthode. Pour déterminer si un Ã©lément est déjà présent dans la collection, la comparaison est basée sur les valeurs des Ã©léments. 
-
-L'interface Set possède deux implémentations concrètes : 
-
-\begin{description}
-    \item[ArraySet] Implémentation basée sur les tableaux.
-    \item[HashSet] Implémentation basée sur une table de hachage.
-\end{description}
-
-Exemple avec l'implémentation ArraySet :
-\lstinputlisting[language=Nit]{./modules/listings/set1_c.nit}
-
-\section{Collections gérées sous la forme clé/valeur}
-Ce type de collection gère les Ã©léments avec deux entités : une clé et une valeur associée. La clé doit Ãªtre unique donc il ne peut y avoir de doublons. En revanche la même valeur peut Ãªtre associée Ã  plusieurs clés différentes.
-
-\subsection{Interface Map}
-L'interface Map définit les méthodes d'une collection gérant des ensembles clés => valeur. Elle hérite de l'interface Collection et introduit ou redéfinit les méthodes suivantes :
-
-\begin{tabularx}{\linewidth}{|c|X|}
-    \hline
-    Méthode & Rôle \\
-    \hline
-    [](K):E & Retourne l'élément E correspondant Ã  la clé K. \\
-    \hline
-    []=(K, E) & Définit l'élément E Ã  la clé K. \\
-    \hline
-    has\_key(K):Bool & Indique si un Ã©lément existe Ã  la clé K. \\
-    \hline
-    recover\_with(Map[K, E]) & Ajoute chaque valeur de la Map passée en paramètre dans la Map courante. En cas de conflit de clé, la valeur de la Map courante est remplacée par celle en paramètre.  \\
-    \hline
-    remove\_at(K) & Retire l'élément correspondant Ã  la clé K. \\
-    \hline
-\end{tabularx}
-
-L'interface Map possède une implémentation concrète basée sur une table de hachage, HashMap.
-
-Voici un exemple d'utilisation d'une HashMap :
-\lstinputlisting[language=Nit]{./modules/listings/hashmap1_c.nit}
-
-\section{Tri des collections}
-Pour trier les collections, Nit propose la classe abstraite AbstractSorter. Elle apporte des fonctionnalités de tri pour les tableaux mais doit Ãªtre spécialisée pour pouvoir Ãªtre utilisée. 
-
-\begin{tabularx}{\linewidth}{|c|X|}
-    \hline
-    Méthode & Rôle \\
-    \hline
-    compare(E, E):Int & Méthode abstraite de comparaison. \\
-    \hline
-    sort(Array[E]) & Trie le tableau passé en paramètre. \\
-    \hline
-\end{tabularx}
-
-La méthode compare doit Ãªtre redéfinie dans une sous classe afin de pouvoir Ãªtre utilisée.
-
-Nit propose une implémentation par défaut basée sur les comparables : ComparableSorter.
-
-Voici un exemple de son utilisation :
-\lstinputlisting[language=Nit]{./modules/listings/sorter1_c.nit}
-
diff --git a/doc/developpez/nit.tex b/doc/developpez/nit.tex
deleted file mode 100644 (file)
index d90f7a2..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-\documentclass[letterpaper,11pt]{doc_nit}
-% Titre du document et auteur
-\title{Développez en Nit}
-\author{Université du Québec Ã  Montréal}
-\date{v0.5}
-
-% Début du document
-\begin{document}
-
-% Génération de la page de garde
-\maketitle
-
-\chapter*{Introduction}
-\section*{Contact}
-Le projet Nit a une liste de diffusion (\url{nitlanguage-discussion@lists.nitlanguage.org}) où les utilisateurs et les développeurs peuvent discuter de diverses questions et s'entraider.
-
-\section*{A propos de ce document}
-Ce document débuté en 2010 présente le langage Nit et son utilisation dans son Ã©tat actuel. Il est voué Ã  Ã©voluer avec le temps.
-
-Aujourd'hui, celui-ci est composé de 4 chapitres :
-\begin{itemize}
-    \item Présentation de Nit
-    \item Syntaxes et Ã©léments de bases de Nit
-    \item Programmation Orientée Objet
-    \item Modules de la librairie standard Nit
-\end{itemize}
-
-Pour toutes modifications ou corrections, merci de contacter la mailing list.
-
-La dernière version publiée de ce document est disponible au format PDF sur le site officiel de Nit : \url{http://www.nitlanguage.org/}.
-
-La version PDF de ce document est réalisée grâce Ã  l'outil Kile (KDE Integrated LaTeX Environment) version 2.0.85 de Kile Team. Cet outil peut Ãªtre téléchargé Ã  l'adresse : http://kile.sourceforge.net.
-
-\section*{Remerciements}
-Ce document s'inspire de la documentation Développons en Java rédigé par Jean Michel Doudoux, merci Ã  lui.
-
-La dernière version publiée du document original est disponible aux formats HTML et PDF sur son site : \url{http://www.jmdoudoux.fr/java/}
-
-Il est aussi disponible dans les deux formats Ã  l'adresse : \url{http://jmdoudoux.developpez.com/cours/developpons/java/}
-
-\pagebreak
-
-\section*{Notes de licence}
-Copyright (C) 2010 UQAM
-Vous pouvez copier, redistribuer et/ou modifier ce document selon les termes de la Licence de Documentation Libre GNU, Version 1.3 ou toute autre version ultérieure publiée par la Free Software Foundation; les Sections Invariantes Ã©tant constituées du chapitre Préambule, aucun Texte de Première de Couverture, et aucun Texte de Quatrième de Couverture. Une copie de la licence est incluse dans la section GNU Free Documentation Licence de ce document.
-
-La version la plus récente de cette licence est disponible Ã  l'adresse : \url{http://www.fsf.org/copyleft/fdl.html}.
-
-% Génération de la table des matières
-\tableofcontents
-
-%Part : Présentation de Nit
-\input{./presentation/presentation.tex}
-
-%Part : Syntaxes et Ã©léments de bases de Nit
-\input{./syntaxe/syntaxe.tex}
-
-%Part : Programmation Orientée Objet
-\input{./poo/poo.tex}
-
-%Part : Modules de la librairie standard Nit
-\input{./modules/modules.tex}
-
-\part*{Annexes}
-\input{./licence.tex}
-
-% Fin du document
-\end{document}
\ No newline at end of file
diff --git a/doc/developpez/poo/listings/abstract1_c.nit b/doc/developpez/poo/listings/abstract1_c.nit
deleted file mode 100644 (file)
index 9dc5bcf..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-abstract class ClasseAbstraite
-       fun methode 
-       do
-               # code partagé par tous les descendants
-       end
-end
-
-class ClasseComplete
-       super ClasseAbstraite
-end
-
-var o = new ClasseComplete
-o.methode
diff --git a/doc/developpez/poo/listings/abstract2_c.nit b/doc/developpez/poo/listings/abstract2_c.nit
deleted file mode 100644 (file)
index 5fbd61c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-class MaClasse
-       fun methode(i: Int): Int is abstract
-end
-
-class MonAutreClasse
-       super MaClasse
-       redef fun methode(i: Int): Int 
-       do
-               return i
-       end
-end
diff --git a/doc/developpez/poo/listings/accesseurs1_c.nit b/doc/developpez/poo/listings/accesseurs1_c.nit
deleted file mode 100644 (file)
index 1f53c57..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-class MaClasse
-       var minutes: Int
-
-       fun heures: Int 
-       do
-               return minutes / 60
-       end
-
-       fun heures=(val: Int)
-       do
-               minutes = val * 60
-       end
-end
diff --git a/doc/developpez/poo/listings/accesseurs2_c.nit b/doc/developpez/poo/listings/accesseurs2_c.nit
deleted file mode 100644 (file)
index 6b5f2a2..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-class Test 
-       var attribut1: String = "Getter public"
-       protected var attribut2: String = "Getter protected"
-end
-
-var test = new Test
-
-print test.attribut1 #Getter public
-#print test.attribut2 #Illégal puisque le getter implicite est défini comme protected
diff --git a/doc/developpez/poo/listings/accesseurs3_c.nit b/doc/developpez/poo/listings/accesseurs3_c.nit
deleted file mode 100644 (file)
index 3982e2d..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-class Test 
-       var attribut1: String writable = "Attribut 1"
-       protected var attribut2: String protected writable = "Attribut 2"
-end
-
-var test = new Test
-
-test.attribut1= "Setter public"
-print test.attribut1 #Setter public
diff --git a/doc/developpez/poo/listings/accesseurs4_c.nit b/doc/developpez/poo/listings/accesseurs4_c.nit
deleted file mode 100644 (file)
index f52be92..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-interface I
-       fun attr: Int is abstract
-       fun attr=(o: Int) is abstract
-end
-
-class A
-super I
-       redef var attr: Int redef writable
-end
-
diff --git a/doc/developpez/poo/listings/attribut1_c.nit b/doc/developpez/poo/listings/attribut1_c.nit
deleted file mode 100644 (file)
index f1b6a76..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-class MaClasse
-       var monAttribut1: Int
-       var monAttribut2: String
-end
diff --git a/doc/developpez/poo/listings/attribut2_c.nit b/doc/developpez/poo/listings/attribut2_c.nit
deleted file mode 100644 (file)
index 4c0c29b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-class MaClasse
-       var monAttribut1: Int = 1
-       var monAttribut2: String = "toto"
-end
-
-var o = new MaClasse
-
-print o.monAttribut1 #1
-print o.monAttribut2 #toto
diff --git a/doc/developpez/poo/listings/coercition1_c.nit b/doc/developpez/poo/listings/coercition1_c.nit
deleted file mode 100644 (file)
index 83be83d..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-class Animal
-end
-
-class Vache
-       super Animal
-
-       fun broute 
-       do
-               print "La vache broute..."
-       end
-end
-       
-var x: Animal = new Vache
-x.as(Vache).broute
diff --git a/doc/developpez/poo/listings/coercition2_s.nit b/doc/developpez/poo/listings/coercition2_s.nit
deleted file mode 100644 (file)
index 48a3e40..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-if x isa Vache then
-       # Ici, le type statique de x est Vache
-       x.broute
-end
-# Le type statique de x est redevnu Animal
diff --git a/doc/developpez/poo/listings/comparaison1_s.nit b/doc/developpez/poo/listings/comparaison1_s.nit
deleted file mode 100644 (file)
index 8ee736b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-var r1 = new Rectangle(100,50)
-var r2 = new Rectangle(100,50)
-
-print r1 == r1 #true
-print r1 == r2 #false
diff --git a/doc/developpez/poo/listings/comparaison2_c.nit b/doc/developpez/poo/listings/comparaison2_c.nit
deleted file mode 100644 (file)
index f594a9c..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-var s1 = "toto"
-var s2 = "toto"
-var i1 = 12
-
-print s1 == s2 #true
-print s1 is s2 #false
-
-print s1.is_same_type(s2) #true
-print s1.is_same_type(i1) #false
diff --git a/doc/developpez/poo/listings/constructeur1_c.nit b/doc/developpez/poo/listings/constructeur1_c.nit
deleted file mode 100644 (file)
index ca7fb7a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-class MaClasse
-       init 
-       do
-               print "Appel du constructeur"
-       end
-end
-
-var o = new MaClasse
diff --git a/doc/developpez/poo/listings/constructeur2_c.nit b/doc/developpez/poo/listings/constructeur2_c.nit
deleted file mode 100644 (file)
index 8a8026f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-class MaClasse
-
-       var entier: Int
-       var chaine: String      
-
-       # Le constructeur par défaut sera init(Int, String)
-end
-
-var o = new MaClasse(10, "toto")
diff --git a/doc/developpez/poo/listings/constructeur3_c.nit b/doc/developpez/poo/listings/constructeur3_c.nit
deleted file mode 100644 (file)
index 44f7700..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-class MaClasse
-
-       var entier: Int
-       var chaine: String      
-
-       # Réécriture du constructeur par défaut
-       init(i: Int, s: String)
-       do
-               entier = i
-               chaine = s
-       end
-end
-
-var o = new MaClasse(10, "toto")
diff --git a/doc/developpez/poo/listings/constructeur4_c.nit b/doc/developpez/poo/listings/constructeur4_c.nit
deleted file mode 100644 (file)
index 18ec2d1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-class MaClasse
-
-       var entier: Int
-       var chaine: String      
-
-       # Constructeur utilisant des valeurs par défaut
-       init 
-       do
-               entier = 10
-               chaine = "toto"
-       end
-
-       # Constructeur nommé acceptant des valeurs
-       init with_value(i: Int) 
-       do
-               entier = i
-               chaine = "tata"
-       end
-end
-
-var o1 = new MaClasse
-var o2 = new MaClasse.with_values(10)
diff --git a/doc/developpez/poo/listings/gen1_c.nit b/doc/developpez/poo/listings/gen1_c.nit
deleted file mode 100644 (file)
index 14a8da5..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-class Solo
-       var valeur: String writable
-end
diff --git a/doc/developpez/poo/listings/gen2_c.nit b/doc/developpez/poo/listings/gen2_c.nit
deleted file mode 100644 (file)
index 443eeea..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-class Solo
-       var valeur: Object writable
-end
-
-var val: Solo = new Solo(10)
-
-var x: Int = val.valeur.as(Int)
diff --git a/doc/developpez/poo/listings/gen3_c.nit b/doc/developpez/poo/listings/gen3_c.nit
deleted file mode 100644 (file)
index 0fb7a0e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-class Solo[T]
-       var valeur: T writable
-end
-
-var solo_int = new Solo[Int](10)
-var x: Int = solo_int.valeur
-
-var solo_string = new Solo[String]("toto")
-var x: String = solo_string.valeur
diff --git a/doc/developpez/poo/listings/gen4_s.nit b/doc/developpez/poo/listings/gen4_s.nit
deleted file mode 100644 (file)
index 5cbc753..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-class Solo[T: Animal]
-       var valeur: T writable
-end
-
-var soloAnimal = new Solo[Animal](new Animal)
-var soloVache = new Solo[Vache](new Vache)
-
-soloAnimal = soloVache
diff --git a/doc/developpez/poo/listings/gen5_c.nit b/doc/developpez/poo/listings/gen5_c.nit
deleted file mode 100644 (file)
index a822ab2..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-class Duo[T, S]
-       var valeur1: T writable
-       var valeur2: S writable
-end
-
-var duo = new Duo[Int, String](10, "toto")
-
-var i: Int = duo.valeur1
-var s: String = duo.valeur2
diff --git a/doc/developpez/poo/listings/heritage1_s.nit b/doc/developpez/poo/listings/heritage1_s.nit
deleted file mode 100644 (file)
index 24ec2f9..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-class ClasseFille
-       super ClasseMere1
-       super ClasseMere2
-
-       # Corps de la classe fille
-
-end
diff --git a/doc/developpez/poo/listings/import1_c.nit b/doc/developpez/poo/listings/import1_c.nit
deleted file mode 100644 (file)
index 325fa8d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-import test
-
-var a = new A
diff --git a/doc/developpez/poo/listings/interface_c.nit b/doc/developpez/poo/listings/interface_c.nit
deleted file mode 100644 (file)
index 3da822d..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-interface AfficheType
-       fun afficherType is abstract
-end
-
-class Personne 
-       super AfficheType
-
-       redef fun afficherType 
-       do
-               print "Je suis une personne"
-       end
-
-end
-
-class Voiture
-       super AfficheType
-
-       redef fun afficherType 
-       do
-               print "Je suis une voiture"
-       end
-end
diff --git a/doc/developpez/poo/listings/isset_c.nit b/doc/developpez/poo/listings/isset_c.nit
deleted file mode 100644 (file)
index c99a42a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-class A
-
-       var attr: nullable String
-
-       fun meth do
-               if isset attr then print attr
-       end
-end
-
-var a = new A
-a.meth
diff --git a/doc/developpez/poo/listings/methode1_c.nit b/doc/developpez/poo/listings/methode1_c.nit
deleted file mode 100644 (file)
index e25c442..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-class MaClasse
-       fun methode1 
-       do
-               print "Bonjour !"
-       end
-
-       fun methode2: String 
-       do
-               return "Bonjour !"
-       end
-end
diff --git a/doc/developpez/poo/listings/methode2_c.nit b/doc/developpez/poo/listings/methode2_c.nit
deleted file mode 100644 (file)
index 82b2de3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-class MaClasse
-       fun methode1 
-       do
-               print "Bonjour M. X !"
-       end
-
-       fun methode2(prenom: String) 
-       do
-               print "Bonjour {prenom} !"
-       end
-end
-
-var o = new MaClasse
-o.methode1 #Bonjour M. X
-o.methode2("Dave") #Bonjour Dave !
diff --git a/doc/developpez/poo/listings/methode4_s.nit b/doc/developpez/poo/listings/methode4_s.nit
deleted file mode 100644 (file)
index 4e8970d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-o.methode1 # Appel sans paramètre
-o.methode2("Dave") # Appel avec un paramètre
-o.methode3("Dave", 20) #Appel avec plusieurs paramètres
diff --git a/doc/developpez/poo/listings/methode5_c.nit b/doc/developpez/poo/listings/methode5_c.nit
deleted file mode 100644 (file)
index 87a2b2f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-print "abcd".substring(1, 2).to_upper #BC
diff --git a/doc/developpez/poo/listings/methode6_c.nit b/doc/developpez/poo/listings/methode6_c.nit
deleted file mode 100644 (file)
index 79a677f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-class MaClasse
-       fun +(i: Int): String 
-       do
-               return "J'ajoute {i} Ã  l'objet de type MaClasse..."
-       end
-end
-
-var o = new MaClasse
-print o+10
diff --git a/doc/developpez/poo/listings/methode7_c.nit b/doc/developpez/poo/listings/methode7_c.nit
deleted file mode 100644 (file)
index d3d8e88..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-class MaClasse
-       fun methode(prenom, nom: String) 
-       do
-               print "Bonjour {prenom} {nom} !"
-       end
-end
-
-var o = new MaClasse
-o.methode("John", "Doe") #Bonjour John Do !
diff --git a/doc/developpez/poo/listings/methode8_c.nit b/doc/developpez/poo/listings/methode8_c.nit
deleted file mode 100644 (file)
index 2982ad7..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-print("test")
-print "test" # Ca marche aussi
diff --git a/doc/developpez/poo/listings/methode9_c.nit b/doc/developpez/poo/listings/methode9_c.nit
deleted file mode 100644 (file)
index 2bf0059..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-class A
-       fun methode(x: Int, y: Int..., z: Int)
-       do
-               print "x = {x}; y = {y.join(",")}; z = {z}"
-       end
-end
-
-var a = new A
-a.methode(1,2,3,4) # Affiche "x = 1; y = 2,3; z = 4"
-a.methode(1,2,3) # Affiche "x = 1; y = ; z = 2"
diff --git a/doc/developpez/poo/listings/new1_s.nit b/doc/developpez/poo/listings/new1_s.nit
deleted file mode 100644 (file)
index 67867ce..0000000
+++ /dev/null
@@ -1 +0,0 @@
-var instance = new MaClasse
diff --git a/doc/developpez/poo/listings/new2_s.nit b/doc/developpez/poo/listings/new2_s.nit
deleted file mode 100644 (file)
index 4e65359..0000000
+++ /dev/null
@@ -1 +0,0 @@
-var instance: MaClasse = new MaClasse
diff --git a/doc/developpez/poo/listings/new3_s.nit b/doc/developpez/poo/listings/new3_s.nit
deleted file mode 100644 (file)
index e5bf781..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-var instance1 = new MaClasse
-
-var instance2 = instance1 #instance2 ne désigne pas un nouvel objet, en fait instance1 et instance2 désignent tous les deux le même objet.
diff --git a/doc/developpez/poo/listings/nullable1_c.nit b/doc/developpez/poo/listings/nullable1_c.nit
deleted file mode 100644 (file)
index 04db820..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-var ma_var: nullable Int
-
-ma_var = null
diff --git a/doc/developpez/poo/listings/package1_c.nit b/doc/developpez/poo/listings/package1_c.nit
deleted file mode 100644 (file)
index 43df876..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-module test
-
-class A
-       #Corps de la classe
-end
-
-class B
-       #Corps de la classe
-end
diff --git a/doc/developpez/poo/listings/polymorphisme1_c.nit b/doc/developpez/poo/listings/polymorphisme1_c.nit
deleted file mode 100644 (file)
index c651de2..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-abstract class Forme 
-       fun aire :Float is abstract
-end
-class Carre
-       super Forme
-
-       var cote: Float
-
-       init(c: Float) 
-       do
-               cote = c
-       end
-
-       redef fun aire: Float 
-       do
-               return cote * cote
-       end
-end
-class Cercle
-       super Forme
-   
-       var rayon: Float
-
-       init (r: Float) 
-       do
-               rayon = r
-       end
-
-       redef fun aire: Float 
-       do
-               return  pi * rayon * rayon
-       end
-end
-
-var forme: Forme
-
-forme = new Carre(10.0)
-print forme.aire # Affiche "100"
-
-forme = new Cercle(10.0)
-print forme.aire # Affiche "314.15"
diff --git a/doc/developpez/poo/listings/polymorphisme_c.nit b/doc/developpez/poo/listings/polymorphisme_c.nit
deleted file mode 100644 (file)
index 3aca530..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-abstract class Forme 
-       fun aire :Float is abstract
-end
-class Carre
-       super Forme
-
-       var cote: Float
-
-       init(c: Float) 
-       do
-               cote = c
-       end
-
-       redef fun aire: Float 
-       do
-               return cote * cote
-       end
-end
-class Cercle
-       super Forme
-   
-       var rayon: Float
-
-       init (r: Float) 
-       do
-               rayon = r
-       end
-
-       redef fun aire: Float 
-       do
-               return  pi * rayon * rayon
-       end
-end
-
-var forme: Forme
-
-forme = new Carre(10.0)
-print forme.aire # Affiche "100"
-
-forme = new Cercle(10.0)
-print forme.aire # Affiche "314.15"
diff --git a/doc/developpez/poo/listings/redef1_c.nit b/doc/developpez/poo/listings/redef1_c.nit
deleted file mode 100644 (file)
index 4357902..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-class ClasseMere
-       fun methode 
-       do
-               print "Méthode originale"
-       end
-end
-
-class ClasseFille
-       super ClasseMere
-
-       redef fun methode 
-       do
-               print "Méthode redéfinie"
-       end
-end
-
-var o = new ClasseFille
-o.methode #Méthode redéfinie
diff --git a/doc/developpez/poo/listings/redef2_c.nit b/doc/developpez/poo/listings/redef2_c.nit
deleted file mode 100644 (file)
index 5ba0705..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-redef class Object
-
-       fun coucou 
-       do
-               print "Coucou !"
-       end
-end
-
-var i: Int = 10
-
-i.coucou #Coucou !
-
diff --git a/doc/developpez/poo/listings/redef3_c.nit b/doc/developpez/poo/listings/redef3_c.nit
deleted file mode 100644 (file)
index 7e27ee0..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-redef class String
-       redef fun to_s 
-       do
-               return self.to_upper
-       end
-end
-
-var chaine = "Hello World !"
-
-print chaine #HELLO WORLD !
diff --git a/doc/developpez/poo/listings/redef4_c.nit b/doc/developpez/poo/listings/redef4_c.nit
deleted file mode 100644 (file)
index 7a925b0..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-class A 
-       fun methode(a: String, b: Int): Bool
-       do
-               return a[b]
-       end
-end
-
-class B
-       super A
-
-       redef fun methode(a, b)
-       do
-               return a.to_upper[b]
-       end
-end
diff --git a/doc/developpez/poo/listings/redef5_c.nit b/doc/developpez/poo/listings/redef5_c.nit
deleted file mode 100644 (file)
index 3f63f37..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-class A
-       var attr: String
-end
-
-class B
-       super A
-
-       init(attr)
-       do
-               self.attr = attr.to_upper
-       end
-end
-
-var a = new A("toto")
-print a.attr
-
-var b = new B("toto")
-print b.attr
diff --git a/doc/developpez/poo/listings/self_c.nit b/doc/developpez/poo/listings/self_c.nit
deleted file mode 100644 (file)
index 21fd506..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-class A
-       var attr: Int
-
-       fun meth(attr: Int)
-       do
-               self.attr = attr
-       end
-end
-
-var a = new A(10)
-print a.attr # Affiche "10"
-
-a.meth(20)
-
-print a.attr # Affiche "20"
diff --git a/doc/developpez/poo/listings/super1_c.nit b/doc/developpez/poo/listings/super1_c.nit
deleted file mode 100644 (file)
index 18a9905..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-class ClasseMere
-       fun coucou(nom: String) 
-       do
-               print "Bonjour {nom} (depuis la classe mère)"
-       end
-end
-
-class ClasseFille
-       super ClasseMere
-
-       redef fun coucou(nom: String) 
-       do
-               super
-               print "Bonjour {nom} (depuis la classe fille)"
-       end
-end
-
-var o = new ClasseFille
-o.coucou("Dave") #Bonjour Dave (depuis la classe mère)
-                #Bonjour Dave (depuis la classe fille)
diff --git a/doc/developpez/poo/listings/super2_c.nit b/doc/developpez/poo/listings/super2_c.nit
deleted file mode 100644 (file)
index 515bade..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-class ClasseMere
-       init 
-       do
-               print "Constructeur de la super classe"
-       end
-end
-
-class ClasseFille
-       super ClasseMere
-
-       init 
-       do
-               print "Constructeur de la sous classe"
-       end
-end
-
-var o = new ClasseFille # Constructeur de la super classe
-                       # Constructeur de la sous classe
diff --git a/doc/developpez/poo/listings/super3_c.nit b/doc/developpez/poo/listings/super3_c.nit
deleted file mode 100644 (file)
index 2cc6dd0..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-class ClasseMere
-       init 
-       do
-               print "Constructeur de la super classe"
-       end
-end
-
-class ClasseFille
-       super ClasseMere
-
-       init 
-       do
-               print "Constructeur de la sous classe"
-               super
-       end
-end
-
-var o = new ClasseFille # Constructeur de la sous classe
-                       # Constructeur de la super classe
diff --git a/doc/developpez/poo/listings/type1_c.nit b/doc/developpez/poo/listings/type1_c.nit
deleted file mode 100644 (file)
index cf3ad76..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-abstract class Aliment end
-
-class Herbe super Aliment end
-
-class Animal
-       type REGIME: Aliment
-
-       fun manger(x: REGIME) do print "Je mange"
-end
-
-class Vache
-       super Animal
-
-       redef type REGIME: Herbe
-end
-
-var vache = new Vache
-vache.manger(new Herbe)
diff --git a/doc/developpez/poo/listings/type2_c.nit b/doc/developpez/poo/listings/type2_c.nit
deleted file mode 100644 (file)
index 5a381ae..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-abstract class Graph
-       var nodes: Array[Node] = new Array[Node]
-
-       fun add_node(node: Node) 
-       do
-               nodes.add(node)
-       end
-end
-
-class Node end
diff --git a/doc/developpez/poo/listings/type3_s.nit b/doc/developpez/poo/listings/type3_s.nit
deleted file mode 100644 (file)
index 9ace3cd..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-class XMLDocument super Graph end
-
-class XMLNode super Node end
diff --git a/doc/developpez/poo/listings/type4_s.nit b/doc/developpez/poo/listings/type4_s.nit
deleted file mode 100644 (file)
index e452f25..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-var doc = new XMLDocument
-
-doc.add_node(new XMLNode) # Jusque là  tout va bien
-
-doc.add_node(new Node) # Cet ajout là  n'a aucun sens !
diff --git a/doc/developpez/poo/listings/type5_s.nit b/doc/developpez/poo/listings/type5_s.nit
deleted file mode 100644 (file)
index 82e28e2..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-class XMLDocument 
-       super Graph
-
-       redef var nodes: Array[XMLNode] = new Array[XMLNode]
-
-       redef fun add_node(node: XMLNode) 
-       do
-               super(node)
-       end
-end
diff --git a/doc/developpez/poo/listings/type6_s.nit b/doc/developpez/poo/listings/type6_s.nit
deleted file mode 100644 (file)
index 25acb5d..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-abstract class Graph
-       type NODE: Node
-       
-       var nodes: Array[NODE] = new Array[NODE]
-
-       fun add_node(node: NODE) 
-       do
-               nodes.add(node)
-       end
-end
-
-class Node end
-
-class XMLDocument 
-       super Graph 
-
-       redef type NODE: XMLNode
-end
-
-class XMLNode super Node end
-
-var doc = new XMLDocument
-
-doc.add_node(new XMLNode) 
-#doc.add_node(new Node) # Cet ajout déclenche une erreur de type Ã  la compilation
diff --git a/doc/developpez/poo/poo.tex b/doc/developpez/poo/poo.tex
deleted file mode 100644 (file)
index 8c94b9b..0000000
+++ /dev/null
@@ -1,515 +0,0 @@
-\part{Programmation orientée objet}\r
-\chapter{Concept de classe}\r
-L'idée de base de la programmation orientée objet est de rassembler dans une même entité les données et les traitements qui s'y appliquent. Dans cette partie, nous allons voir comment Nit permet de développer en objet.\r
-\r
-Une classe est le support de l'encapsulation : c'est un ensemble de données et de fonction regroupées dans une même entité. Une classe est une description abstraite d'un ensemble d'objet ayant des propriétés communes. Les fonctions qui opèrent sur les données sont appelées des méthodes. Les données en elles-mêmes sont appelées des attributs. Les attributs et les méthodes représentent les propriétés de la classe.\r
-\r
-Rappelons qu'en Nit absolument TOUT est objet.\r
-\r
-Pour accéder Ã  une classe il faut en déclarer une instance ou objet.\r
-\r
-Une classe se compose de deux parties : un en-tête et un corps. Le corps peut Ãªtre divisé en deux sections : la déclaration de ses propriétés (attributs) et la définition des méthodes. Les méthodes et les données sont pourvues d'attributs de visibilité qui gèrent leur accessibilité par les composants hors de la classe.\r
-\r
-Une classe comporte donc sa déclaration, des attributs et la définition de ses méthodes.\r
-\r
-En Nit, toutes les classes héritent forcément de la classe |Object|. Cette relation d'héritage est implicite, c'est Ã  dire qu'il n'est pas nécessaire de la déclarer.\r
-\r
-\section{Syntaxe et déclaration d'une classe}\r
-La syntaxe de déclaration d'un classe est la suivante :\r
-\begin{lstlisting}[language=Nit]\r
-    [redef][abstract] class nomDeClasse [super classeMere...]\r
-        ...\r
-    end\r
-\end{lstlisting}\r
-\r
-Les modificateurs de classe sont :\r
-\begin{description}\r
-    \item[abstract] Une classe abstraite est une classe contenant une ou plusieurs méthodes abstraites, qui n'ont pas de déclaration explicite. Une classe déclarée |abstract| ne peut pas Ãªtre instanciée : il faut définir une classe qui hérite de cette classe et qui implémente les méthodes nécessaires pour ne plus Ãªtre abstraite (voir section~\ref{classes-abstraites} \nameref{classes-abstraites}).\r
-    \item[redef] Ce modificateur permet de raffiner une classe pour y ajouter ou modifier des propriétés (voir section~\ref{redef} \nameref{redef}).\r
-\end{description}\r
-\r
-Le mot clé |super| permet de spécifier une ou des superclasses Ã©ventuelles : ce mot clé permet de préciser une classe mère dans une relation d'héritage. Nit supporte l'héritage multiple, il est donc possible d'utiliser plusieurs fois |super| sur la même classe (voir chapitre~\ref{heritage} \nameref{heritage}).\r
-\r
-L'ordre des méthodes dans une classe n'a pas d'importance. Si dans une classe, on rencontre d'abord la méthode A puis la méthode B, B peut Ãªtre appelée sans problème dans A.\r
-\r
-\chapter{Objets}\r
-La classe est la description d'un objet. Un objet est une instance d'une classe. Pour chaque instance d'une classe, le code est le même, seules les données (valeurs des attributs) sont différentes pour chaque objet.\r
-\r
-\section{Instancier une classe : créer un objet}\r
-L'opérateur |new| se charge de créer une nouvelle instance d'une classe et de l'associer Ã  une variable.\r
-\r
-Exemple :\r
-\lstinputlisting[language=Nit]{./poo/listings/new1_s.nit}\r
-\r
-Cela n'est pas obligatoire grâce au typage adaptatif (voir chapitre~\ref{typage-adaptatif} \nameref{typage-adaptatif}) mais on peut aussi préciser le type sur la variable qui va recevoir l'instance :\r
-\lstinputlisting[language=Nit]{./poo/listings/new2_s.nit}\r
-\r
-En Nit, toutes les classes sont instanciées par allocation dynamique Ã  part les types universels (voir chapitre~\ref{universal} \nameref{universal}). Dans l'exemple précédent, la variable |instance| contient une référence sur un objet de la classe instanciée (contient l'adresse de l'objet qu'elle désigne : attention toutefois, il n'est pas possible de manipuler ou d'effectuer des opérations directement sur cette adresse comme en C).\r
-\r
-\lstinputlisting[language=Nit]{./poo/listings/new3_s.nit}\r
-\r
-L'opérateur |new|, lorsqu'il instancie la classe, appelle une méthode particulière de cet objet : le constructeur (voir chapitre~\ref{constructeurs} \nameref{constructeurs}).\r
-\r
-\section{Durée de vie d'un objet}\r
-La durée de vie d'un objet ne correspond pas forcément Ã  la durée de vie du programme.\r
-\r
-La durée de vie d'un objet passe par trois Ã©tapes :\r
-\begin{description}\r
-    \item[La création] de l'objet grâce Ã  l'opérateur d'instanciation |new|.\r
-    \item[L'utilisation] de l'objet en appelant ses méthodes.\r
-    \item[La destruction] de l'objet, c'est Ã  dire la libération de la mémoire qu'occupe l'objet. En Nit, la libération de la mémoire est automatiquement effectuée par le ramasse miette (garbage collector). Quand le ramasse miette découvre un objet qui ne sera plus utilisé dans le programme alors il va automatiquement le supprimer. Il n'existe pas d'instruction \lstinline[language=C++]{delete} comme en C++.\r
-\end{description}\r
-\r
-\section{Références et comparaison d'objets}\r
-Les variables de  type objet que l'on déclare ne contiennent pas un objet mais une référence vers cet objet. Lorsque l'on Ã©crit |instance1 = instance2|, on copie la référence |instance1| dans |instance2| : |instance1| et |instance2| pointent sur le même objet. Par défaut, l'opérateur |==| est celui de la classe |Object| et permet de comparer ces références. Deux objets avec des propriétés identiques sont deux objets distincts.\r
-\r
-\lstinputlisting[language=Nit]{./poo/listings/comparaison1_s.nit}\r
-Si on souhaite comparer deux objets en se basant sur la valeur de leurs attributs, il est possible de redéfinir l'opérateur |==| dans leur classe (voir section~\ref{redef-operateur} \nameref{redef-operateur}).\r
-\r
-Par exemple, l'opérateur |==| a Ã©té redéfini pour la classe String il est donc possible de comparer deux String en se basant sur leurs valeurs :\r
-\lstinputlisting[language=Nit, linerange=1-5]{./poo/listings/comparaison2_c.nit}\r
-\r
-Il est possible de comparer le type de deux objets, c'est Ã  dire de vérifier si deux objets sont de la même classe ou non. Pour cela il faut utiliser la méthode |is_same_type(o:Object)|. Cette méthode est introduite dans la classe |Object|, comme toutes les classes en héritent implicitement, elle est disponible dans toutes les classes.\r
-\r
-\lstinputlisting[language=Nit, linerange=8-9, firstnumber=last]{./poo/listings/comparaison2_c.nit}\r
-\r
-Pour vérifier que deux variables sont en fait des références vers le même objet, il est possible d'utiliser le mot-clé |is| :\r
-\lstinputlisting[language=Nit, linerange=6-6, firstnumber=last]{./poo/listings/comparaison2_c.nit}\r
-\r
-\section{Types nullable}\r
-En Nit, il existe une particularité pour la valeur |null|. Contrairement Ã  Java il ne peut pas Ãªtre utilisé n'importe où. En effet, Nit propose un mécanisme permettant de limiter statiquement les erreurs fréquentes de type |nullPointerException|.\r
-\r
-Pour qu'une variable puisse prendre la valeur |null|, elle doit avoir Ã©té déclarée explicitement avec le type |nullable| :\r
-\lstinputlisting[language=Nit]{./poo/listings/nullable1_c.nit}\r
-Dans l'exemple précédent, si on omet de préciser le type comme |nullable|, le compilateur Nit lèvera une erreur au moment de la compilation.\r
-\r
-La valeur |null| peut donc Ãªtre utilisée avec n'importe quel type \textit{nullable} mais aucun message ne peut Ãªtre envoyé Ã  |null|.\r
-\r
-\chapter{Modificateurs d'accès}\r
-Les modificateurs d'accès assurent le contrôle des conditions d'héritage, d'accès aux Ã©léments et de modification de données par les autres classes. Ils s'appliquent aussi bien aux classes qu'aux méthodes et attributs.\r
-\r
-\section{Visibilité des entités}\r
-De nombreux langages orientés objet introduisent des attributs de visibilité pour réglementer l'accès aux classes et aux objets, aux méthodes et aux données.\r
-\r
-Il existe 2 modificateurs qui peuvent Ãªtre utilisés pour définir les attributs de visibilité des entités (classes, méthodes ou attributs) : |private| et |protected|. Leur utilisation permet de définir des niveaux de protection différents (présentés dans un ordre croissant de niveau de protection offert) :\r
-\r
-%TODO reformuler\r
-\begin{description}\r
-    \item[Par défaut : public] Il n'existe pas de mot clé pour définir ce niveau, qui est le niveau par défaut lorsqu'aucun modificateur n'est précisé. Un attribut ou une méthode public est visible par tous les autres objets. Dans la philosophie orientée objet, aucun attribut ne devrait Ãªtre déclaré public : il est préférable d'écrire des méthodes pour le consulter et le modifier.\r
-    \item[protected] Si un attribut ou une méthode est déclaré |protected|, seules les méthodes des sous classes pourront y accéder.\r
-    \item[private] C'est le niveau de protection le plus fort. Les composants ne sont visibles qu'à l'intérieur du fichier où est définie la classe.\r
-\end{description}\r
-\r
-Ces modificateurs d'accès sont mutuellement exclusifs.\r
-\r
-\section{Classes abstraites}\r
-\label{classes-abstraites}\r
-\r
-Le mot clé |abstract| peut Ãªtre appliqué Ã  une classe qui ne doit pas Ãªtre instanciée. Cela permet de créer une classe qui sera une sorte de moule : toutes les classes dérivées pourront profiter des méthodes héritées.\r
-\r
-\lstinputlisting[language=Nit]{./poo/listings/abstract1_c.nit}\r
-\r
-Essayer d'instancier une classe abstraite générera une erreur de compilation.\r
-\r
-\chapter{Méthodes}\r
-Les méthodes sont des fonctions qui implémentent les traitements de la classe.\r
-\r
-\section{Syntaxe et déclaration}\r
-La syntaxe de la déclaration d'une méthode est :\r
-\begin{lstlisting}[language=Nit]\r
-    [redef] [protected|private] fun nom_de_méthode[( arg1:Type, ... )][:Type_retourné] do\r
-        ...\r
-    end\r
-\end{lstlisting}\r
-\r
-\section{Types retournés}\r
-Le type retourné correspond au type de l'objet qui est renvoyé par la méthode. Si la méthode ne retourne rien, alors on ne précise pas le type retourné.\r
-\r
-La valeur de retour de la méthode doit Ãªtre transmise par l'instruction |return|. Elle indique la valeur que prend la méthode et termine celle ci : les instructions qui suivent |return| Ã  l'intérieur du même bloc ne seront pas exécutées. Si des instructions sont placées après le mot clé |return|, une erreur |unreachable statement| sera levée lors de la compilation.\r
-\r
-\lstinputlisting[language=Nit]{./poo/listings/methode1_c.nit}\r
-\r
-Il est possible d'inclure une instruction |return| dans une méthode sensée ne rien retourner : cela permet de quitter la méthode.\r
-\r
-\section{Passage de paramètres}\r
-Les paramètres des méthodes sont déclarés entre parenthèses et séparés par des virgules. Le type et le nombre de paramètres déclarés doivent correspondre au type et au nombre de paramètres transmis. Si une méthode n'accepte pas de paramètres, il suffit de ne pas indiquer de parenthèses :\r
-\lstinputlisting[language=Nit]{./poo/listings/methode2_c.nit}\r
-\r
-Si plusieurs paramètres ont le même type, il est possible de le factoriser :\r
-\lstinputlisting[language=Nit]{./poo/listings/methode7_c.nit}\r
-\r
-Il n'est pas possible d'indiquer des valeurs par défaut dans les paramètres. \r
-\r
-Lorsqu'un objet est passé comme paramètre Ã  une méthode, cette dernière reçoit une référence qui désigne son emplacement mémoire d'origine. Il est possible de modifier l'objet grâce Ã  ces méthodes mais il n'est pas possible de remplacer la référence contenue dans la variable passée en paramètre : ce changement n'aura lieu que localement Ã  la méthode.\r
-\r
-\section{Envoi de message}\r
-Un message est Ã©mis lorsqu'on demande Ã  un objet d'exécuter l'une de ses méthodes.\r
-La syntaxe d'appel d'une méthode est : |objet.methode(paramètre, ...)|\r
-\r
-Si la méthode appelée ne contient aucun paramètre, il n'est pas nécessaire de mettre les parenthèses.\r
-\r
-\lstinputlisting[language=Nit]{./poo/listings/methode4_s.nit}\r
-\r
-Quand l'appel de méthode se fait en dehors d'une expression et qu'elle n'accepte qu'un seul paramètre, il est possible de ne pas utiliser les parenthèses :\r
-\lstinputlisting[language=Nit]{./poo/listings/methode8_c.nit}\r
-\r
-\section{Nombre variable de paramètres}\r
-Il est possible d'indiquer qu'une méthode peut recevoir un nombre variable de paramètre grâce Ã  l'opérateur |...|. Le paramètre sera alors considéré comme un tableau du type spécifié. L'envoi de message pourra alors contenir zéro, un ou plusieurs arguments pour le paramètre ainsi déclaré.\r
-\r
-\lstinputlisting[language=Nit]{./poo/listings/methode9_c.nit}\r
-\r
-Un seul paramètre variable est autorisé dans une signature.\r
-\r
-\section{Enchaînement de références}\r
-Il est possible d'enchaîner les envois de messages aux retours des méthodes :\r
-\lstinputlisting[language=Nit]{./poo/listings/methode5_c.nit}\r
-\r
-Ici on appelle la méthode \textit{to\_upper} de l'objet retourné par la méthode \textit{substring} de l'objet \textit{"abcd"}.\r
-\r
-\section{Mot-clé self}\r
-\r
-Le mot-clé |self| est l'équivalent du |this| en Java. Il permet de pointer sur le receveur courant :\r
-\lstinputlisting[language=Nit]{./poo/listings/self_c.nit}\r
-\r
-\section{Redéfinition d'opérateurs}\r
-\label{redef-operateur}\r
-\r
-Avec Nit il est possible de définir ou redéfinir des opérateurs arithmétiques (|+|, |-|, |*|...) pour chacune de nos classes en suivant la même déclaration que pour une méthode normale :\r
-\lstinputlisting[language=Nit]{./poo/listings/methode6_c.nit}\r
-\r
-La seule restriction est que la méthode doit forcément prendre un et un seul paramètre et retourner quelque chose.\r
-\r
-\section{Surcharge statique de méthode}\r
-Pour des raisons liées Ã  l'héritage, Nit ne permet pas la surcharge statique des méthodes. Il n'est donc pas possible de définir plusieurs fois une même méthode avec des types de paramètres différents.\r
-\r
-\section{Méthodes abstraites}\r
-Une méthode abstraite est une méthode déclarée avec le modificateur |is abstract| et sans corps. Elle correspond Ã  une méthode dont on veut forcer l'implémentation dans une sous classe. \r
-\r
-La syntaxe de la déclaration d'une méthode abstraite est :\r
-\begin{lstlisting}[language=Nit]\r
-    [redef] [protected|private] fun nom_de_méthode[( arg1:Type, ... )][:Type_retourné] is abstract\r
-\end{lstlisting}\r
-\r
-\lstinputlisting[language=Nit, linerange=1-3]{./poo/listings/abstract2_c.nit}\r
-\r
-Pour pouvoir utiliser la méthode, il faut la redéfinir dans une sous classe grâce au mot clé |redef| (voir section~\ref{redef} \nameref{redef}) :\r
-\lstinputlisting[language=Nit, linerange=5-11, firstnumber=last]{./poo/listings/abstract2_c.nit}\r
-\r
-Contrairement Ã  d'autres langages, une classe n'est pas automatiquement abstraite dès lors qu'une de ses méthodes est déclarée abstraite. Cela est lié au concept de raffinement de classe que nous aborderons un peu plus tard (voir section~\ref{raffinement-classe} \nameref{raffinement-classe}).\r
-\r
-Un appel Ã  une méthode abstraite n'est pas décelé au moment de la compilation (toujours Ã  cause du raffinement de classe) mais au moment de l'exécution.\r
-\r
-\chapter{Attributs}\r
-Les données d'une classe sont contenues dans des variables nommées attributs. \r
-\r
-\section{Déclaration des attributs}\r
-Le mot-clé |var| permet aussi de déclarer un attribut dans le corps de la classe. En Nit, tous les attributs doivent avoir un type explicite.\r
-\r
-\lstinputlisting[language=Nit]{./poo/listings/attribut1_c.nit}\r
-\r
-Chaque instance de la classe a accès Ã  sa propre occurrence de l'attribut.\r
-\r
-Il est possible de définir des valeurs par défaut pour chaque attribut :\r
-\lstinputlisting[language=Nit]{./poo/listings/attribut2_c.nit}\r
-\r
-\section{Accesseurs}\r
-L'encapsulation permet de sécuriser l'accès aux données d'une classe, la bonne pratique consiste donc Ã  créer des méthodes permettant d'accéder indirectement Ã  ces données : les accesseurs. Nit applique Ã  la lettre cette bonne pratique en empêchant systématiquement tout accès direct Ã  l'attribut. En effet, pour chaque attribut déclaré dans une classe, Nit va généré un accesseur automatiquement pour en permettre l'accès.\r
-\r
-Un accesseur est une méthode qui donne l'accès Ã  une variable d'instance. Pour une variable d'instance, il peut ne pas y avoir d'accesseur, un accesseur en lecture (getter) et/ou un accesseur en Ã©criture (setter). \r
-\r
-Il reste tout de même possible de définir ses propres accesseurs :\r
-\lstinputlisting[language=Nit]{./poo/listings/accesseurs1_c.nit}\r
-\r
-Les accesseurs manuels sont tout a fait comme des méthodes et acceptent de ce fait les modificateurs d'accès de visibilité. Pour les accesseurs automatiques, le principe est différent.\r
-\r
-Pour les getters, c'est la visibilité de l'attribut qui va déterminer la visibilité de la méthode :\r
-\begin{description}\r
-    \item[par défaut (public)] Le getter automatique sera généré avec la visibilité public.\r
-    \item[protected] Le getter automatique sera généré avec la visibilité |protected|.\r
-    \item[private] Le getter automatique sera généré avec la visibilité |private|.\r
-\end{description}\r
-\r
-Voici un exemple d'utilisation des getters automatiques :\r
-\lstinputlisting[language=Nit]{./poo/listings/accesseurs2_c.nit}\r
-\r
-Pour les setters, ils sont toujours générer comme Ã©tant |private|. Pour changer cette visibilité, il est nécessaire de préciser l'attribut comme |writable| en lui rajoutant la visibilité souhaitée :\r
-\begin{description}\r
-    \item[writable] Le setter automatique sera généré avec la visibilité public.\r
-    \item[protected writable] Le setter automatique sera généré avec la visibilité |protected|.\r
-    \item[private writable] Le setter automatique sera généré avec la visibilité |private| (c'est le comportement par défaut).\r
-\end{description}\r
-\r
-Voici un exemple d'utilisation des setters automatiques :\r
-\lstinputlisting[language=Nit]{./poo/listings/accesseurs3_c.nit}\r
-\r
-\section{Redéfinition d'attributs}\r
-Les accesseurs automatiques sont considérés comme des méthodes normales, ils peuvent donc Ãªtre hérités et redéfinis. De plus les accesseurs automatiques peuvent Ãªtre utilisés pour redéfinir des accesseurs manuels. |redef var| permet de préciser une redéfinition du getter alors que |redef writable| permet de redéfinir le setter :\r
-\lstinputlisting[language=Nit]{./poo/listings/accesseurs4_c.nit}\r
-\r
-\section{Opérateur isset}\r
-\r
-Pour vérifier si un attribut a Ã©té initialisé, on peut utiliser l'opérateur |isset| :\r
-\lstinputlisting[language=Nit,]{./poo/listings/isset_c.nit}\r
-\r
-\chapter{Constructeurs}\r
-\label{constructeurs}\r
-\r
-\section{Constructeurs standards}\r
-L'instanciation d'un objet est suivie d'une sorte d'initialisation par le moyen d'une méthode particulière appelée constructeur pour que les variables aient une valeur de départ. Elle n'est systématiquement invoquée que lors de la création d'un objet.\r
-\r
-La syntaxe de la déclaration d'une constructeur est :\r
-\begin{lstlisting}[language=Nit]\r
-    [redef] [protected|private] init [nom][( arg1:Type, ... )] do\r
-        ...\r
-    end\r
-\end{lstlisting}\r
-\r
-Un constructeur ne possède pas de type de retour. \r
-\r
-\lstinputlisting[language=Nit]{./poo/listings/constructeur1_c.nit}\r
-\r
-La définition d'un constructeur est facultative. Si aucun constructeur n'est explicitement défini dans la classe, le compilateur va créer un constructeur par défaut en fonction des attributs définis dans la classe :\r
-\lstinputlisting[language=Nit]{./poo/listings/constructeur2_c.nit}\r
-\r
-Bien sûr, il est possible de forcer un constructeur en le déclarant explicitement afin de créer un constructeur différent que celui qui serait généré par défaut:\r
-\lstinputlisting[language=Nit]{./poo/listings/constructeur3_c.nit}\r
-\r
-\section{Constructeurs nommés}\r
-En Nit, il n'est pas possible de surcharger un constructeur. En revanche, il est possible de nommer les constructeurs :\r
-\lstinputlisting[language=Nit]{./poo/listings/constructeur4_c.nit}\r
-\r
-\section{Constructeurs abstraits}\r
-Les constructeurs peuvent Ãªtre déclarés comme abstrait avec la syntaxe suivante :\r
-\begin{lstlisting}[language=Nit]\r
-    [redef] [protected|private] init [nom][( arg1:Type, ... )] is abstract\r
-\end{lstlisting}\r
-\r
-\chapter{Héritage}\r
-\label{heritage}\r
-L'héritage est un mécanisme qui facilite la réutilisation du code et la gestion de son Ã©volution. Elle définit une relation entre deux classes :\r
-\begin{itemize}\r
-  \item une classe mère ou super classe\r
-  \item une classe fille ou sous classe qui hérite de sa classe mère\r
-\end{itemize}\r
-\r
-\section{Principes de l'héritage}\r
-Grâce Ã  l'héritage, les objets d'une classe fille ont accès aux données et aux méthodes des classes parentes et peuvent les Ã©tendre. Les sous classes peuvent redéfinir les attributs et les méthodes héritées. \r
-\r
-L'héritage successif de classes permet de définir une hiérarchie de classe qui se compose de super classes et de sous classes. Une classe qui hérite d'une autre est une sous classe et celle dont elle hérite est une super classe. Une classe peut avoir plusieurs sous classes et plusieurs classes mères. |Object| est la classe parente de toutes les classes en Nit. Tous les attributs et méthodes contenues dans |Object| sont accessibles Ã  partir de n'importe quelle classe car par héritages successifs toutes les classes héritent d'|Object|.\r
-\r
-\section{Mise en \oe{}uvre}\r
-On utilise le mot clé |super| pour indiquer qu'une classe hérite d'une autre. En l'absence de ce mot réservé associé Ã  une classe, le compilateur considère la classe |Object| comme classe mère.\r
-\lstinputlisting[language=Nit]{./poo/listings/heritage1_s.nit}\r
-\r
-Pour invoquer une méthode d'une classe parent, il suffit d'utiliser le mot-clé |super|. Les paramètres seront transmis automatiquement :\r
-\lstinputlisting[language=Nit]{./poo/listings/super1_c.nit}\r
-\r
-En Nit, il est obligatoire dans un constructeur d'une classe fille de faire appel explicitement ou implicitement au constructeur de la classe mère. \r
-\r
-Si rien n'est précisé alors l'appel sera fait implicitement, le constructeur de la classe mère sera appelé avant le constructeur de la classe fille :\r
-\lstinputlisting[language=Nit]{./poo/listings/super2_c.nit}\r
-\r
-Si |super| est utilisé, alors l'appel sera fait Ã  l'endroit précisé :\r
-\lstinputlisting[language=Nit, linerange=8-19]{./poo/listings/super3_c.nit}\r
-\r
-\section{Accès aux propriétés héritées}\r
-Les variables et méthodes définies avec le modificateur d'accès par défaut (public) restent publiques Ã  travers l'héritage et toutes les autres classes.\r
-Une variable d'instance définie avec le modificateur |private| est bien héritée mais elle n'est pas accessible directement mais via les méthodes héritées (mise Ã  part dans le fichier où est définie la classe).\r
-\r
-Si l'on veut conserver pour une propriété une protection semblable Ã  celle assurée par le modificateur |private|, il faut utiliser le modificateur |protected|. La propriété ainsi définie sera héritée dans toutes les classes descendantes qui pourront y accéder en utilisant le mot-clé |self| mais ne sera pas accessible sur tout autre receveur.\r
-\r
-\section{Redéfinition de méthodes}\r
-\label{redef}\r
-La redéfinition d'une méthode héritée doit impérativement conserver la déclaration de la méthode parent (type et nombre de paramètres et la valeur de retour doivent Ãªtre identiques). Si la signature de la méthode change, ce n'est plus une redéfinition mais une surcharge... et rappelez-vous : ce n'est pas autorisé en Nit.\r
-\r
-Pour redéfinir une méthode, il suffit d'utiliser le mot-clé |redef| :\r
-\lstinputlisting[language=Nit]{./poo/listings/redef1_c.nit}\r
-\r
-Lors de la redéfinition d'une méthode avec le mot-clé |redef|, il n'est pas nécessaire de préciser Ã  nouveau le prototype de la méthode :\r
-\lstinputlisting[language=Nit]{./poo/listings/redef4_c.nit}\r
-\r
-%\section{Redéfinition de constructeurs}\r
-\r
-%\subsubsection{Redéfinition de constructeurs automatiques}\r
-\r
-%Les constructeurs automatiques ou manuel sont transmis de la classe mère Ã  la classe fille par héritage. Il est possible de redéfinir un constructeur automatique sans utiliser le mot-clé |redef| comme ceci :\r
-%\lstinputlisting[language=Nit]{./poo/listings/redef5_c.nit}\r
-\r
-\section{Polymorphisme}\r
-Le polymorphisme est la capacité, pour un même message, de correspondre Ã  plusieurs formes de traitements selon l'objet auquel ce message est adressé. La gestion du polymorphisme est assurée dynamiquement Ã  l'exécution.\r
-\r
-L'idée est de partir d'un type et de le modifier. Par exemple, on peut créer une classe de base, puis faire des classes dérivées :\r
-\lstinputlisting[language=Nit, linerange=1-35]{./poo/listings/polymorphisme_c.nit}\r
-\r
-On peut ensuite traiter les objets de la même manière quelques soit leur type dynamique :\r
-\lstinputlisting[language=Nit, linerange=37-43, firstnumber=last]{./poo/listings/polymorphisme_c.nit}\r
-\r
-L'héritage définit un sous-typage implicite de la classe fille vers la classe mère : on peut affecter Ã  une référence d'une classe n'importe quel objet d'une de ses sous classes.\r
-\r
-\section{Coercition}\r
-La coercition (conversion de type) peut Ãªtre utilisée dans le cadre d'un cast standard grâce au mot-clé |as| :\r
-\lstinputlisting[language=Nit]{./poo/listings/coercition1_c.nit}\r
-\r
-L'inconvénient de cette méthode est que si l'objet n'avait pas Ã©té dynamiquement typé en tant que Vache, une erreur d'exécution serait survenue lors du cast puisque celui-ci aurait Ã©choué.\r
-\r
-Nit propose une méthode plus sûre permettant de changer temporairement le type statique d'une variable au mot-clé |isa| :\r
-\lstinputlisting[language=Nit,firstnumber=last]{./poo/listings/coercition2_s.nit}\r
-\r
-\section{Interfaces}\r
-Une interface est un ensemble de déclarations de méthodes correspondant un peu Ã  une classe abstraite. C'est une sorte de standard auquel une classe peut répondre. Tous les objets qui se conforment Ã  cette interface (qui implémentent cette interface) possèdent donc les méthodes déclarées dans celle-ci. Plusieurs interfaces peuvent Ãªtre implémentées par une même classe.\r
-\r
-Les interfaces se comportent donc comme des classes un peu spéciales :\r
-\begin{itemize}\r
-    \item Une interface ne peut Ã©tendre qu'une interface ;\r
-    \item Une interface ne peut pas avoir de constructeur (méthode init) ;\r
-    \item Une interface ne peut donc pas Ãªtre instanciée ;\r
-    \item Une interface ne peut pas avoir d'attributs ;\r
-\end{itemize}\r
-\r
-En Nit, il est possible d'implémenter le corps des méthodes directement dans l'interface, celui-ci sera alors transmis par héritage.\r
-\r
-Voici la syntaxe d'une interface :\r
-\begin{lstlisting}[language=Nit]\r
-    interface nom_interface [super interface_mere...]\r
-        ...\r
-    end\r
-\end{lstlisting}\r
-\r
-Un exemple de déclaration d'une interface :\r
-\lstinputlisting[language=Nit]{./poo/listings/interface_c.nit}\r
-\r
-Les interfaces sont ensuite intégrées aux autres classes avec le mot-clé |super| :\r
-\lstinputlisting[language=Nit, linerange=5-22, firstnumber=last]{./poo/listings/interface_c.nit}\r
-\r
-\chapter{Types universels}\r
-\label{universal}\r
-\r
-Les types universels sont déclarés Ã  l'aide du mot-clé |universal|. Il s'agit d'éléments qui ne peuvent pas Ãªtre spécialisés, qui ne peuvent spécialiser que des interfaces, n'ont pas d'attributs et pas de constructeurs.\r
-\r
-Les types universels peuvent avoir des instances mais elles ne sont pas initialisées par le développeur, c'est Ã  dire qu'il est impossible d'utiliser le mot-clé |new| avec un type universel.\r
-\r
-Int et Bool sont deux exemples de types universels.\r
-\r
-\chapter{Généricité et types virtuels}\r
-\r
-\section{Généricité}\r
-Le principe de la généricité est de factoriser les méthodes pouvant s'appliquer Ã  n'importe quelle variable quel que soit son type en Ã©vitant les problèmes de coercition.\r
-\r
-\subsection{Généricité simple}\r
-Prenons un exemple de classe non générique :\r
-\lstinputlisting[language=Nit]{./poo/listings/gen1_c.nit}\r
-\r
-Si nous souhaitons pouvoir utiliser cette classe avec d'autres objets que des |String|, il serait possible de se baser sur le type le plus haut dans la hiérarchie Nit, c'est Ã  dire |Object| :\r
-\lstinputlisting[language=Nit, linerange=1-3]{./poo/listings/gen2_c.nit}\r
-\r
-Voyons maintenant ce qui se passe quand nous utilisons cette classe avec des |Int| :\r
-\lstinputlisting[language=Nit, linerange=5-7, firstnumber=last]{./poo/listings/gen2_c.nit}\r
-\r
-Vous remarquerez qu'il est nécessaire d'utiliser un cast pour utiliser le retour du |getter| de l'attribut |valeur| puisque celui-ci est de type |Object|. Ce n'est pas pratique et potentiellement dangereux pour la stabilité du programme puisque le risque d'erreur d'exécution sur un cast qui a Ã©choué augmente.\r
-\r
-Dans ce cas, la généricité apporte une solution fiable et robuste. Elle permet de paramétrer des méthodes avec un type de données joker qui sera résolu dynamiquement au moment de l'instanciation de l'objet.\r
-\r
-Voici le code de la classe déclarée comme générique :\r
-\lstinputlisting[language=Nit, linerange=1-3]{./poo/listings/gen3_c.nit}\r
-\r
-Dans cette classe, le T n'est pas encore défini, cela se fera Ã  l'instanciation. Par contre, une fois instancié avec un type, l'objet ne pourra travailler qu'avec le type de données spécifié Ã  l'instanciation.\r
-\r
-La déclaration d'une classe générique se fait en précisant le type joker (représenté par n'importe quel mot) entre crochet |[T]|. Il suffit ensuite d'implémenter les méthodes comme nous le ferions habituellement mais en remplaçant les types par le joker que nous avons défini dans la déclaration de la classe.\r
-\r
-Voyons comment utiliser notre classe générique avec des entiers :\r
-\lstinputlisting[language=Nit, linerange=5-6, firstnumber=last]{./poo/listings/gen3_c.nit}\r
-\r
-Ou encore avec des chaînes de caractères :\r
-\lstinputlisting[language=Nit, linerange=8-9, firstnumber=last]{./poo/listings/gen3_c.nit}\r
-\r
-\subsection{Généricité bornée}\r
-Dans certains cas, il peut Ãªtre utile de limiter la portée de la généricité Ã  un certain nombre de types ayant la même intention. Pour cela nous pouvons utiliser l'héritage afin de n'autoriser que les sous-types d'une certaine classe. C'est le principe de la généricité bornée.\r
-\r
-Imaginons cette fois que la classe Solo n'a de sens que si elle est utilisée avec un objet de type Animal ou l'un de ses sous-type. Nous allons pouvoir préciser la borne sur notre joker dans la définition de la classe générique :\r
-\lstinputlisting[language=Nit, linerange=1-3]{./poo/listings/gen4_s.nit}\r
-\r
-Il n'est maintenant plus possible d'utiliser cette classe avec autre chose que le type Animal ou l'un de ses sous-type.\r
-\r
-En réalité, toute classe utilisant la généricité sans borne apparente est bornée implicitement sur |[T: nullable Object]|.\r
-\r
-\subsection{Généricité et héritage}\r
-Nit, contrairement Ã  d'autres langages, supporte la covariance des variables dans le cas des classes génériques.\r
-\r
-L'exemple suivant est donc tout Ã  fait valable en Nit :\r
-\lstinputlisting[language=Nit, linerange=5-8, firstnumber=last]{./poo/listings/gen4_s.nit}\r
-\r
-\subsection{Généricité multiple}\r
-Nit supporte aussi la généricité multiple comme le montre l'exemple suivant :\r
-\lstinputlisting[language=Nit]{./poo/listings/gen5_c.nit}\r
-\r
-\section{Types virtuels}\r
-Les types virtuels permettent définir au sein d'une classe un champ qui va contenir un type plutôt d'un objet. Ce champ peut ensuite Ãªtre utilisé pour typer les paramètres et les types de retour des méthodes. Sa valeur sera exploitée Ã  la compilation pour définir le type Ã  utiliser.\r
-\r
-Exemple d'utilisation d'un type virtuel :\r
-\lstinputlisting[language=Nit]{./poo/listings/type1_c.nit}\r
-\r
-A quoi peuvent servir les types virtuels ?\r
-\r
-Prenons un exemple très simplifié qui n'utilise pas les types virtuels :\r
-\lstinputlisting[language=Nit]{./poo/listings/type2_c.nit}\r
-\r
-Nous souhaitons maintenant Ã©tendre cette classe pour représenter un XMLDocument comprenant des XMLNode :\r
-\lstinputlisting[language=Nit,firstnumber=last]{./poo/listings/type3_s.nit}\r
-\r
-Jusque là tout va bien. Essayons maintenant de manipuler cette classe :\r
-\lstinputlisting[language=Nit,firstnumber=last]{./poo/listings/type4_s.nit}\r
-\r
-Pour forcer l'utilisation de la méthode add\_node de XMLDocument avec un paramètre de type XMLNode, nous voilà obligé de redéfinir entièrement la classe Node :\r
-\lstinputlisting[language=Nit]{./poo/listings/type5_s.nit}\r
-\r
-Nous aurions pu Ã©viter cela en utilisant les types virtuels :\r
-\lstinputlisting[language=Nit]{./poo/listings/type6_s.nit}\r
-\r
-\chapter{Modules}\r
-En Nit, il existe un moyen de regrouper des classes voisines ou qui couvrent un même domaine : ce sont les modules.\r
-\r
-\section{Définition d'un module}\r
-En Nit, la convention est de regrouper les classes qui doivent faire partie du même module dans un même fichier. Le nom du module doit correspondre au nom du fichier sans l'extension .nit.\r
-\r
-Pour spécifier le nom du moule, il suffit de rajouter la directive |module nom_du_module| au début du fichier :\r
-\lstinputlisting[language=Nit]{./poo/listings/package1_c.nit}\r
-\r
-Le mot-clé |module| doit Ãªtre la première instruction dans un fichier source et il ne doit Ãªtre présent qu'une seule fois dans le fichier source (une classe ne peut pas appartenir Ã  plusieurs modules).\r
-\r
-\section{Utilisation d'un module}\r
-\r
-\subsection{Import standard}\r
-Pour utiliser ensuite le module ainsi créé, on l'importe dans le fichier grâce Ã  l'instruction :\r
-\begin{lstlisting}[language=Nit]\r
-    [intrude|private] import nom_du_module\r
-\end{lstlisting}\r
-\lstinputlisting[language=Nit]{./poo/listings/import1_c.nit}\r
-\r
-Si le nom du module diffère du nom du fichier, le compilateur ne sera pas capable de lier le module est retournera une erreur Ã  la compilation : no ressource found for module nom\_du\_module.\r
-\r
-Pour l'instant il n'est pas possible d'importer des modules se trouvant dans un autre répertoire que celui où se trouvent les fichiers sources.\r
-\r
-\subsection{Import privé}\r
-Si on utilise le mot-clé |private| devant le |import|, le module sera importé dans le module courant comme privé. C'est Ã  dire que les modules qui importeront le module courant ne verrons pas les classes et les propriétés importées.\r
-\r
-\subsection{Import intrusif}\r
-L'utilisation du mot-clé |intrude| avant l'import d'un module permet d'importer le module en mode intrusif, c'est Ã  dire d'ignorer toutes les restrictions liées Ã  la visibilité. Ainsi les méthodes déclarées |private| seront considérées comme publiques.\r
-\r
-Cette fonctionnalité est Ã  utiliser avec beaucoup de précautions, elle est même déconseillée dans la plupart des cas.\r
-\r
-\section{Raffinement de classe}\r
-\label{raffinement-classe}\r
-Nit permet de redéfinir des classes depuis une autre module pour en modifier les méthodes ou en rajouter, c'est le raffinement de classe.\r
-\r
-Pour modifier une classe déjà déclarée il faut utiliser le mot-clé |redef| :\r
-\lstinputlisting[language=Nit]{./poo/listings/redef2_c.nit}\r
-\r
-Ici, nous venons de raffiner la classe Object pour lui ajouter la méthode coucou. Maintenant Object et toutes ses sous classes possèdent la méthode coucou. Par exemple nous appelons la méthode coucou sur l'objet de type Int.\r
-\r
-Il est aussi possible de redéfinir les méthodes déjà existantes :\r
-\lstinputlisting[language=Nit]{./poo/listings/redef3_c.nit}\r
-\r
-Dans cet exemple nous avons redéfini la méthode to\_s de la classe String afin de retourner toutes les chaines en majuscules.\r
-\r
-\chapter{Importation de la bibliothèque standard}\r
-Il faut noter que les modules de la bibliothèque standard sont toujours importés implicitement lors de la compilation si aucun import n'a Ã©té spécifié. Par exemple il n'est pas nécessaire d'importer le module string pour utiliser la classe String.\r
diff --git a/doc/developpez/presentation/listings/hello_world_s.nit b/doc/developpez/presentation/listings/hello_world_s.nit
deleted file mode 100644 (file)
index f4da9af..0000000
+++ /dev/null
@@ -1 +0,0 @@
-print "Hello World!"
diff --git a/doc/developpez/presentation/presentation.tex b/doc/developpez/presentation/presentation.tex
deleted file mode 100644 (file)
index 7fa039c..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-\part{Présentation de Nit}\r
-\r
-\chapter{Caractéristiques}\r
-Nit est un langage de programmation orienté objet dont la syntaxe est proche de celle des langages de scripts. Le but de Nit est de proposer un langage de programmation robuste Ã  typage statique, où la structure n'est pas une torture.\r
-\begin{description}\r
-       \item[Nit est compilé]Le code source de Nit est compilé pour Ãªtre ensuite traduit en C.\r
-       \item[Nit est orienté objet]Comme la plupart des langages récents, Nit est orienté objet. Chaque fichier source contient la définition d'une ou plusieurs classes qui sont utilisées les unes avec les autres pour former une application. En Nit, TOUT est objet (Et oui même a = 0, c'est de l'objet).\r
-       \item[Nit supporte l'héritage multiple]Avec Nit il est possible de faire hériter une classe de plusieurs classes parentes, et bien d'autres choses plus intéressantes encore !\r
-       \item[Nit est fortement typé]Toutes les variables sont statiquement typées mais Nit utilise le typage adaptatif. C'est Ã  dire qu'il devinera automatiquement et adaptera le type statique d'une variable en fonction de son utilisation dans le programme. Il n'est donc plus nécessaire de spécifier un type Ã  chaque déclaration (mais cela reste possible). Le typage fort n'est plus une torture !\r
-       \item[Nit assure la gestion de la mémoire]L'allocation de la mémoire pour un objet est automatique Ã  sa création et Nit récupère automatiquement la mémoire utilisée grâce Ã  un ramasse miette qui restitue les zones de mémoires laissées libres suite Ã  la destruction des objets.\r
-\end{description}\r
-\r
-\begin{quote}\r
-\centering\r
-    \textsc{\textbf{Nit : A Fun Language for Serious Programming !}}\r
-\end{quote}\r
-\r
-\chapter{Historique}\r
-Nit est le descendant direct de PRM développé en 2005 au LIRMM en France. Il s'agissait d'un langage jouet servant Ã  expérimenter des traits de langage et des techniques d'implémentation.\r
-\r
-En 2008 nait Nit un langage plus généraliste développé conjointement Ã  l'UQAM et au LIRMM. Il Ã©tend PRM en y ajoutant utilisabilité et robustesse.\r
-\r
-Aujourd'hui, en 2011, le développement de Nit continue...\r
-\r
-\r
-\chapter{Installation de Nit}\r
-Le compilateur Nit est librement accessible grâce Ã  git : \r
-\begin{description}\r
-       \item[Protocole GIT]\url{git://nitlanguage.org/nit.git}\r
-       \item[Protocole HTTP]\url{http://nitlanguage.org/nit.git}\r
-\end{description}\r
-\r
-La documentation de la librairie standard se trouve sur le site web de Nit : \url{http://nitlanguage.org/}\r
-\r
-Pour télécharger le compilateur :\r
-\begin{lstlisting}[language=bash]\r
-$ git clone git://nitlanguage.org/nit.git\r
-\end{lstlisting}\r
-ou\r
-\begin{lstlisting}[language=bash]\r
-$ git clone http://nitlanguage.org/nit.git\r
-\end{lstlisting}\r
-\r
-Il faut maintenant compiler le compilateur :\r
\r
-\begin{lstlisting}[language=bash,firstnumber=last]\r
-$ cd nit\r
-$ make\r
-\end{lstlisting}\r
-\r
-Ça y est, le compilateur Nit est maintenant installé sur votre ordinateur !\r
-\r
-\chapter{Compilation et exécution}\r
-Un programme Nit est composé d'un ou plus généralement plusieurs fichiers source. N'importe quel Ã©diteur de texte peut Ãªtre utilisé pour modifier un fichier Nit.\r
-\r
-Ces fichiers source possèdent l'extension \og .nit \fg. Ils peuvent contenir du code, une ou plusieurs classes et/ou modules.\r
-\r
-Il est nécessaire de compiler le source pour pouvoir l'exécuter. Le compilateur \textbf{nitc} est utilisé pour compiler chaque fichier source en code exécutable par la machine. Lors de la compilation, les fichiers sources Ã©crits en Nit seront transformés en C pour Ãªtre exécutés.\r
-\r
-Commençons par créer le classique Hello World dans le fichier hello\_world.nit :\r
-\lstinputlisting[language=Nit]{./presentation/listings/hello_world_s.nit}\r
-\r
-A présent il faut le compiler :\r
-\begin{lstlisting}[language=bash]\r
-$ bin/nitc hello_world.nit\r
-\end{lstlisting}\r
-\r
-Puis l'exécuter comme on le ferait en C :\r
-\begin{lstlisting}[language=bash,firstnumber=last]\r
-$ ./hello_world\r
-\end{lstlisting}
\ No newline at end of file
diff --git a/doc/developpez/syntaxe/listings/array2_c.nit b/doc/developpez/syntaxe/listings/array2_c.nit
deleted file mode 100644 (file)
index e09ea1a..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-var tableau = ["toto", "titi", "tata"]
-
-for case in tableau do
-       print case #toto, titi, tata
-end
diff --git a/doc/developpez/syntaxe/listings/array_c.nit b/doc/developpez/syntaxe/listings/array_c.nit
deleted file mode 100644 (file)
index 29c82ff..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-var tableau = new Array[String]
-
-tableau[0] = "toto"
-tableau[1] = "tata"
-
-print tableau[0] #Affiche "toto"
-print tableau[1] #Affiche "tata"
diff --git a/doc/developpez/syntaxe/listings/assert_c.nit b/doc/developpez/syntaxe/listings/assert_c.nit
deleted file mode 100644 (file)
index 964eedb..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-var i = -1
-
-assert etiquette: i > 0 else
-       print "Erreur fatale, i ne devrait pas Ãªtre négatif"
-end
-# Retoune une erreur d'exécution : Assert 'etiquette' failed
diff --git a/doc/developpez/syntaxe/listings/break_c.nit b/doc/developpez/syntaxe/listings/break_c.nit
deleted file mode 100644 (file)
index 51a0330..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-for i in [0..100] do
-       if i > 4 then
-               break
-       end
-       print i
-end
-#Affiche 0,1,2,3,4
diff --git a/doc/developpez/syntaxe/listings/char1_c.nit b/doc/developpez/syntaxe/listings/char1_c.nit
deleted file mode 100644 (file)
index d6eedd0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-var char:Char = 'a'
diff --git a/doc/developpez/syntaxe/listings/chariot_s.nit b/doc/developpez/syntaxe/listings/chariot_s.nit
deleted file mode 100644 (file)
index 24b8532..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-if x then foo
-if x then 
-       foo
-end
diff --git a/doc/developpez/syntaxe/listings/comment_s.nit b/doc/developpez/syntaxe/listings/comment_s.nit
deleted file mode 100644 (file)
index 61f5759..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#Commentaire sur une ligne
-var maVar = 1 #Commentaire en fin de ligne
diff --git a/doc/developpez/syntaxe/listings/continue_c.nit b/doc/developpez/syntaxe/listings/continue_c.nit
deleted file mode 100644 (file)
index 0753bcb..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-for i in [0..10] do
-       if i%2 != 0 then
-               continue
-       end
-       print i
-end
-#Affiche 0,2,4,6,8,10
diff --git a/doc/developpez/syntaxe/listings/declaration_s.nit b/doc/developpez/syntaxe/listings/declaration_s.nit
deleted file mode 100644 (file)
index 0f362e7..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-var x:Int
-x = 0
-var x:Int = 0
-var x = 0
diff --git a/doc/developpez/syntaxe/listings/do_c.nit b/doc/developpez/syntaxe/listings/do_c.nit
deleted file mode 100644 (file)
index ecf8db9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-do
-       var x = 5
-       print x # Affiche 5
-end
-# x n'est plus défini Ã  partir d'ici
diff --git a/doc/developpez/syntaxe/listings/for_c.nit b/doc/developpez/syntaxe/listings/for_c.nit
deleted file mode 100644 (file)
index cf37b73..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-for i in [0..5] do
-       print i
-end
-#Affiche 0 1 2 3 4 5
-
-var debut = 0
-var fin = 5
-for i in [debut..fin] do
-       print i
-end
-#Affiche 0 1 2 3 4 5
-
-for i in [10*0..10-5] do
-       print i
-end
-#Affiche 0 1 2 3 4 5
-
-for i in [1, 3, 5] do print i #Affiche 1 3 5
diff --git a/doc/developpez/syntaxe/listings/if_c.nit b/doc/developpez/syntaxe/listings/if_c.nit
deleted file mode 100644 (file)
index 39aab0d..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-var booleen = true
-if booleen then
-       print "Le booléen vaut TRUE !"
-else
-       print "Le booléen vaut FALSE !"
-end
-#Affiche "Le booléen vaut TRUE !"
-
-var ma_var = 1
-if ma_var < 0 then 
-       print "ma_var est negative"
-else if ma_var > 0 then
-       print "ma_var est positive"
-else
-       print "ma_var = 0"
-end
-#Affiche "ma_var est positive"
diff --git a/doc/developpez/syntaxe/listings/label_c.nit b/doc/developpez/syntaxe/listings/label_c.nit
deleted file mode 100644 (file)
index 7bab0d8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-var largeur = 3
-var hauteur = 3
-
-for i in [0..largeur] do
-       for j in [0..hauteur] do
-               if i > 2 then break label boucle_largeur
-       end
-end label boucle_largeur
diff --git a/doc/developpez/syntaxe/listings/loop_c.nit b/doc/developpez/syntaxe/listings/loop_c.nit
deleted file mode 100644 (file)
index de1cc41..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-var i = 0
-
-loop
-       print i
-       i += 1
-       
-       if i > 5 then break
-end
-# Affiche 0 1 2 3 4 5
diff --git a/doc/developpez/syntaxe/listings/new_s.nit b/doc/developpez/syntaxe/listings/new_s.nit
deleted file mode 100644 (file)
index 67867ce..0000000
+++ /dev/null
@@ -1 +0,0 @@
-var instance = new MaClasse
diff --git a/doc/developpez/syntaxe/listings/nullable_c.nit b/doc/developpez/syntaxe/listings/nullable_c.nit
deleted file mode 100644 (file)
index 1865f86..0000000
+++ /dev/null
@@ -1 +0,0 @@
-var x:nullable Int
diff --git a/doc/developpez/syntaxe/listings/string2_c.nit b/doc/developpez/syntaxe/listings/string2_c.nit
deleted file mode 100644 (file)
index 533c6f1..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-var s1 = "Dave"
-var s2 = "Da" + "ve"
-
-print s1 == s2 #true
diff --git a/doc/developpez/syntaxe/listings/string3_c.nit b/doc/developpez/syntaxe/listings/string3_c.nit
deleted file mode 100644 (file)
index 77919fd..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-var chaine = "toto"
-
-print chaine[0] # Affiche "t"
diff --git a/doc/developpez/syntaxe/listings/string4_c.nit b/doc/developpez/syntaxe/listings/string4_c.nit
deleted file mode 100644 (file)
index 13d4df6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-print "NIT is a fun language ! "*4
diff --git a/doc/developpez/syntaxe/listings/string_c.nit b/doc/developpez/syntaxe/listings/string_c.nit
deleted file mode 100644 (file)
index b259a1b..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-var string:String = "Hello World"
-
-print string.to_upper # Affiche "HELLO WORLD"
-
-string += "Coucou" + "!"
-
-print " Une voiture possède : " + 4.to_s + "roues"
-
-var prenom = "David"
-print "Bonjour {prenom.to_upper}! " # Affiche "Bonjour DAVID!"
-
-print " La valeur de Pi est d'environ{3.14}..."
diff --git a/doc/developpez/syntaxe/listings/typage2_c.nit b/doc/developpez/syntaxe/listings/typage2_c.nit
deleted file mode 100644 (file)
index 5d36596..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# Exemple simple
-var x: Object = "une string"
-if x isa Int then
-       # Le type statique de x devient Int
-       print x * 10 # Ok
-end
-
-# Exemple basé sur les opérateurs booléens
-var a: Array[Object] = new Array[Object]
-
-for i in a do
-       # Le type statique de i est Object
-       if not i isa Int then continue
-       # Le type statique de i devient Int
-       print i * 10 # Ok
-end
-
-# Encore plus fort
-var max = 0
-
-for i in a do
-       if i isa Int and i > max then max = 1
-       # Le > est valide puisque dans la partie Ã  gauche du 'and' le type statique de i est Int
-end
diff --git a/doc/developpez/syntaxe/listings/typage3_c.nit b/doc/developpez/syntaxe/listings/typage3_c.nit
deleted file mode 100644 (file)
index ceaa2a2..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-var x : nullable Int = 10
-
-if x != null then
-       # Ici le type statique de x devient Int (sans nullable)
-       print x + 6
-end
-# Le type statique de x redevient nullable Int
diff --git a/doc/developpez/syntaxe/listings/typage_c.nit b/doc/developpez/syntaxe/listings/typage_c.nit
deleted file mode 100644 (file)
index 1c6c397..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-var x # Déclaration d'une variable locale
-
-x = 5 # Le type statique de x devient Int
-print x + 1 # Affiche 6
-
-x = [6, 7] # Le type statique de x devient Array[Int]
-print x[0] # Affiche 6
diff --git a/doc/developpez/syntaxe/listings/var_c.nit b/doc/developpez/syntaxe/listings/var_c.nit
deleted file mode 100644 (file)
index 1e20958..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-var ma_var
-var ma_VAR
diff --git a/doc/developpez/syntaxe/listings/while_c.nit b/doc/developpez/syntaxe/listings/while_c.nit
deleted file mode 100644 (file)
index 097ba67..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-var i = 0
-while i < 5 do
-       print i
-       i += 1
-end
-#Affiche 0 1 2 3 4 5
-
-while true do print "boucle infinie..."
diff --git a/doc/developpez/syntaxe/syntaxe.tex b/doc/developpez/syntaxe/syntaxe.tex
deleted file mode 100644 (file)
index b9ec45e..0000000
+++ /dev/null
@@ -1,434 +0,0 @@
-\part{Syntaxe et Ã©léments de base de Nit}\r
-\r
-\chapter{Syntaxe}\r
-\r
-\section{Nit est sensible Ã  la casse}\r
-Nit est sensible Ã  la casse :\r
-\lstinputlisting[language=Nit]{./syntaxe/listings/var_c.nit}\r
-Ici |ma_var| et |ma_VAR| sont deux variables différentes.\r
-\r
-\section{Retours chariots}\r
-Avec Nit, les retours chariots ont du sens !\r
-\r
-Exemple \og One Liner \fg :\r
-\lstinputlisting[language=Nit,linerange=1-1]{./syntaxe/listings/chariot_s.nit}\r
-Exemple \og Bloc \fg :\r
-\lstinputlisting[language=Nit,linerange=2-4]{./syntaxe/listings/chariot_s.nit}\r
-\r
-Notez que l'indentation est ignorée du compilateur mais elle permet une meilleure compréhension du code par le programmeur, il est donc conseillé de bien indenter son code !\r
-\r
-\pagebreak\r
-\r
-\section{Identificateurs}\r
-\r
-Chaque objet, classe, module ou variable est associé Ã  un nom : l'\textbf{identificateur} qui peut se composer de tous les caractères alphanumériques et du caractère de soulignement (\_). Le premier caractère doit Ãªtre une lettre ou le caractère de soulignement. \r
-\r
-Attention : Le compilateur lèvera une exception si une variable commence par une majuscule.\r
-\r
-Un identificateur ne peut pas appartenir Ã  la liste des mots clés réservés du langage Nit :\r
-\begin{multicols}{4}\r
-  \begin{itemize}\r
-      \item |abort|\r
-      \item |abstract|\r
-      \item |and|\r
-      \item |as|\r
-      \item |assert|\r
-      \item |break|\r
-      \item |class|\r
-      \item |continue|\r
-      \item |do|\r
-      \item |else|\r
-      \item |end|\r
-      \item |extern|\r
-      \item |false|\r
-      \item |for|\r
-      \item |fun|\r
-      \item |if|\r
-      \item |import|\r
-      \item |in|\r
-      \item |init|\r
-      \item |interface|\r
-      \item |intern|\r
-      \item |intrude|\r
-      \item |is|\r
-      \item |isa|\r
-      \item |isset|\r
-      \item |loop|\r
-      \item |label|\r
-      \item |new|\r
-      \item |not|\r
-      \item |null|\r
-      \item |nullable|\r
-      \item |once|\r
-      \item |or|\r
-      \item |package|\r
-      \item |print|\r
-      \item |private|\r
-      \item |protected|\r
-      \item |readable|\r
-      \item |redef|\r
-      \item |return|\r
-      \item |self|\r
-      \item |special|\r
-      \item |super|\r
-      \item |then|\r
-      \item |true|\r
-      \item |type|\r
-      \item |universal|\r
-      \item |var|\r
-      \item |while|\r
-      \item |writable|\r
-  \end{itemize}\r
-\end{multicols}\r
-\r
-\section{Convention d'écriture}\r
-\r
-Quelques règles pour l'écriture d'un programme en Nit :\r
-\begin{itemize}\r
-    \item On préfèrera utiliser la notation basée sur le soulignement pour les variables. Par exemple : |ma_variable| ;\r
-    \item Les types, comme les noms des classes seront Ã©crits en \og CamelCase \fg. Par exemple : |MaClasse| ;\r
-    \item L'indentation est faite avec le caractère de tabulation et est affichée comme 8 espaces ;\r
-    \item Les opérateurs sont entourés d'espaces. Par exemple : |4 + 5| ou |x = 5| ;\r
-    \item Les spécificateurs de type (|:|) et les virgules (|,|) ont un espace après mais pas avant. Par exemple : |var x: X| ou |[1, 2, 3]| ;\r
-    \item Les parenthèses (|()|) et les crochets (|[]|) ne prennent pas d'espaces ;\r
-    \item Le |do| des méthodes se trouve sur sa propre ligne et n'est pas indenté ;\r
-    \item Le |do| des boucles se trouve sur la même ligne que la déclaration de la boucle ;\r
-\end{itemize}\r
-\r
-\section{Commentaires}\r
-Les commentaires ne sont pas pris en compte par le compilateur. En Nit il existe seulement des commentaires sur une seule ligne grâce au caractère |#|. \r
-Il peuvent s'utiliser seulement sur une ligne ou alors en fin de ligne comme le montre l'exemple suivant : \r
-\lstinputlisting[language=Nit]{./syntaxe/listings/comment_s.nit}\r
-\r
-A l'heure actuelle, Nit ne supporte pas les commentaires multi-lignes.\r
-\r
-\chapter{Éléments de base de Nit}\r
-\r
-\section{Déclaration et utilisation des variables}\r
-\r
-Une variable possède un nom, un type et une valeur. Une variable est accessible et utilisable dans le bloc où elle est définie.\r
-\r
-La déclaration d'une variable permet de réserver une zone de la mémoire pour y stocker une valeur.\r
-\r
-En Nit les types peuvent Ãªtre optionnels dans une déclaration. En effet, Nit est un langage statiquement typé par type adaptatif. C'est Ã  dire qu'il est capable de \og deviner \fg le type de la variable déclarée en fonction de son utilisation.\r
-\r
-Déclaration et affectation sur deux lignes en précisant le type :\r
-\lstinputlisting[language=Nit, linerange=1-2]{./syntaxe/listings/declaration_s.nit}\r
-Déclaration et affectation sur une seule ligne en précisant le type :\r
-\lstinputlisting[language=Nit, linerange=3-3]{./syntaxe/listings/declaration_s.nit}\r
-Déclaration et affectation sur une seule ligne sans préciser le type :\r
-\lstinputlisting[language=Nit, linerange=4-4]{./syntaxe/listings/declaration_s.nit}\r
-\r
-Ces trois exemples reviennent strictement au même. Dans le dernier exemple, lorsque l'on affecte 0 Ã  la variable x, Nit comprend que |x| est de type |Int|.\r
-\r
-Rappel : Les noms de variables en Nit peuvent commencer par une lettre ou par le caractères de soulignement. Le reste du nom peut comporter des lettres ou des nombres mais jamais d'espace.\r
-\r
-Nit est un langage Ã  typage rigoureux qui ne possède pas de transtypage automatique lorsque ce transtypage risque de conduire Ã  une perte d'information ou Ã  une erreur d'exécution.\r
-\r
-Pour les objets, il est nécessaire en plus de la déclaration de la variable, de créer un objet avant de pouvoir l'utiliser. Il faut réserver de la mémoire pour la création d'un objet avec l'instruction |new|. Si l'objet n'est plus utilisé, la libération de la mémoire se fait automatiquement grâce au ramasse miettes.\r
-\r
-Exemple d'utilisation du mot clé |new| :\r
-\lstinputlisting[language=Nit]{./syntaxe/listings/new_s.nit}\r
-\r
-Vous remarquerez qu'en Nit, il n'est pas nécessaire d'utiliser les parenthèses si le constructeur ne prend pas de paramètres.\r
-\r
-\section{Type nullable}\r
-Pour Ã©viter les exceptions |nullPointerException| qui peuvent Ãªtre fréquentes sur d'autres langages, Nit impose au développeur de préciser si une variable a le droit de prendre la valeur |null|.\r
-\r
-Pour préciser qu'une variable peut prendre la valeur |null|, il faut utiliser le mot clé |nullable|.\r
-\r
-Exemple :\r
-\lstinputlisting[language=Nit, linerange=1]{./syntaxe/listings/nullable_c.nit}\r
-\r
-En Nit, toute variable déclarée |nullable| mais qui n'a pas Ã©té initialisé a la valeur par défaut |null|. A l'inverse, une variable qui n'est pas déclarée |nullable| et n'est pas initialisée avant d'être utilisée provoquera une erreur de compilation.\r
-\r
-\section{Affectation}\r
-Le signe |=| est l'opérateur d'affectation et s'utilise avec une expression de la forme |variable = expression|.\r
-\r
-Il existe des opérateurs qui permettent de simplifier l'écriture d'une opération d'affectation associée Ã  un opérateur mathématique :\r
-\r
-\begin{tabularx}{\linewidth}{|c|c|X|}\r
-       \hline\r
-       \textbf{Opérateur} & \textbf{Exemple} & \textbf{Signification} \\\r
-       \hline\r
-       = & a = 10 & Ã©quivalent Ã  : a = 10 \\\r
-       \hline\r
-       += & a += 10 & Ã©quivalent Ã  : a = a + 10 \\\r
-       \hline\r
-       -= & a -= 10 & Ã©quivalent Ã  : a = a - 10 \\\r
-       \hline\r
-\end{tabularx}\r
-\r
-\pagebreak\r
-\r
-\section{Comparaison}\r
-\r
-Nit propose les opérateurs pour toutes les comparaisons :\r
-\r
-\begin{tabularx}{\linewidth}{|c|c|X|}\r
-       \hline\r
-       \textbf{Opérateur} & \textbf{Exemple} & \textbf{Signification} \\\r
-       \hline\r
-       > & a > 10 & strictement supérieur \\\r
-       \hline\r
-       < & a < 10 & strictement inférieur \\\r
-       \hline\r
-       >= & a >= 10 & supérieur ou Ã©gal\\\r
-       \hline\r
-       <= & a <= 10 & inférieur ou Ã©gal\\\r
-       \hline\r
-       == & a <= 10 & Ã©gal\\\r
-       \hline\r
-    != & a != 10 & différent de\\\r
-       \hline\r
-       and & a and b & ET logique (pour expressions booléennes) : \newline l'évaluation de l'expression cesse dés qu'elle devient fausse\\\r
-       \hline\r
-       or & a or b & OU logique (pour expressions booléennes) : \newline l'évaluation de l'expression cesse dés qu'elle devient vraie\\\r
-       \hline\r
-    not & not b & NON logique\\\r
-    \hline\r
-\end{tabularx}\r
-\r
-\r
-\section{Priorité des opérateurs}\r
-\r
-Les opérateurs sont exécutés dans l'ordre suivant Ã  l'intérieur d'une expression qui est analysée de gauche Ã  droite :\r
-\begin{itemize}\r
-      \item multiplication, division et reste de division (modulo)\r
-      \item addition et soustraction\r
-      \item comparaison\r
-      \item le signe |=| d'affectation d'une valeur Ã  une variable\r
-      \item NON logique\r
-      \item ET logique\r
-      \item OU logique\r
-\end{itemize}\r
-\r
-L'usage des parenthèses permet de modifier cet ordre de priorité.\r
-       \r
-\section{Structures de contrôles}\r
-\r
-Comme les autres langages de développement, Nit propose un ensemble d'instructions qui permettent d'organiser et de structurer les traitements. L'usage de ces instructions est similaire Ã  celui rencontré Ã  leur Ã©quivalent dans d'autres langages.\r
-\r
-\subsection{Boucles}\r
-\subsubsection{While}\r
-Dans une boucle |while|, le code est exécuté tant que la condition est vraie. Si avant l'instruction |while|, le booléen est faux, alors le code de la boucle ne sera jamais exécuté.\r
-\r
-Exemple :\r
-\lstinputlisting[language=Nit, linerange=1-6]{./syntaxe/listings/while_c.nit}\r
-\r
-Le |while| peut aussi s'écrire sur une seule ligne :\r
-\lstinputlisting[language=Nit, linerange=8]{./syntaxe/listings/while_c.nit}\r
-\r
-\subsubsection{For}\r
-En Nit, TOUT est objet et même les structures de contrôle. Ceci amène donc Ã  une syntaxe un peu particulière. Ne vous en faites pas, on s'y fait !\r
-\r
-Voici donc la syntaxe d'une boucle |for| :\r
-\lstinputlisting[language=Nit, linerange=1-4]{./syntaxe/listings/for_c.nit}\r
-\r
-On peut bien sûr utiliser des variables pour créer nos boucles :\r
-\lstinputlisting[language=Nit, linerange=6-11]{./syntaxe/listings/for_c.nit}\r
-\r
-Ou même des expressions :\r
-\lstinputlisting[language=Nit, linerange=13-16]{./syntaxe/listings/for_c.nit}\r
-\r
-Le |for| peut lui aussi s'écrire sur une ligne :\r
-\lstinputlisting[language=Nit, linerange=18]{./syntaxe/listings/for_c.nit}\r
-\r
-\subsubsection{Loop}\r
-Les boucles infinies sont souvent utilisés accompagnées de l'instruction |break|. Elles sont utiles pour implémenter les boucles de type \og jusqu'à \fg \textit{untill} ou pour simuler le \textit{exit when} de Ada.\r
-\r
-\lstinputlisting[language=Nit]{./syntaxe/listings/loop_c.nit}\r
-\r
-\subsection{Blocs do}\r
-Le |do| simple peut Ãªtre utilisé pour déclarer des blocs de code ou jouer avec la portée des variables.\r
-\r
-\lstinputlisting[language=Nit]{./syntaxe/listings/do_c.nit}\r
-\r
-\subsection{Branchements conditionnels}\r
-Avec Nit il n'existe qu'un seul type de branchement conditionnel : le |if|. On peut l'utiliser avec ou sans clause |else|. \r
-\r
-Exemple :\r
-\lstinputlisting[language=Nit, linerange=1-7]{./syntaxe/listings/if_c.nit}\r
-\r
-On peut aussi utiliser des clauses |else if| pour chaîner plusieurs tests :\r
-\lstinputlisting[language=Nit, linerange=9-17]{./syntaxe/listings/if_c.nit}\r
-\r
-Attention : Si on utilise un |else| ou un |else if|, l'instruction ne peut pas Ãªtre Ã©crit \textit{On Liner}.\r
-\r
-\subsection{Débranchements}\r
-|continue| permet de passer immédiatement Ã  l'itération suivante dans une boucle |for|, |while| ou |loop| :\r
-\lstinputlisting[language=Nit]{./syntaxe/listings/continue_c.nit}\r
-\r
-|break| permet de quitter immédiatement une boucle |for|, |while|, |loop| ou un bloc |do| :\r
-\lstinputlisting[language=Nit]{./syntaxe/listings/break_c.nit}\r
-\r
-Des labels peuvent Ãªtre utilisés pour spécifier sur quel Ã©lément |for|, |while|, |loop| ou |do| doit agir le break :\r
-\lstinputlisting[language=Nit]{./syntaxe/listings/label_c.nit}\r
-\r
-On peut aussi utiliser les labels de la même manière avec l'instruction |continue|.\r
-\r
-\subsection{Arrêt du programme}\r
-L'instruction |abort| permet d'arrêter le programme en lançant une erreur fatale.\r
-\r
-\subsection{Assertions}\r
-L'instruction |assert| vérifie si une expression booléenne est vrai, sinon elle arrêtera le programme comme |abort|. Elle peut Ãªtre combinée Ã  une clause |else| pour exécuter du code avant d'arrêter le programme :\r
-\lstinputlisting[language=Nit]{./syntaxe/listings/assert_c.nit}\r
-\r
-Comme on peut le voir dans l'exemple précédent, une Ã©tiquette peut Ãªtre précisée pour Ãªtre affichée dans le message d'erreur.\r
-\r
-\section{Tableaux}\r
-Les tableaux permettent de stocker un ensemble de valeur du même type dans la même variable. En Nit, la classe de base pour manipuler les tableaux est la classe |Array|. \r
-\r
-\subsection{Déclaration des tableaux}\r
-Pour commencer, il va falloir instancier la classe |Array|. Chaque instance de |Array| ne peut contenir qu'un seul type de variable Ã  la fois. Il faut préciser le type lors de l'instanciation grâce aux crochets |[]|.\r
-\r
-\lstinputlisting[language=Nit, linerange=1]{./syntaxe/listings/array_c.nit}\r
-\r
-Il est ensuite possible d'ajouter des valeurs dans le tableau en précisant dans quelle case du tableau on souhaite ajouter la valeur en utilisant l'opérateur |[]|. \r
-\r
-Exemple :\r
-\lstinputlisting[language=Nit, linerange=3-4, firstnumber=last]{./syntaxe/listings/array_c.nit}\r
-\r
-Ce même opérateur permet de récupérer les valeurs du tableau :\r
-\lstinputlisting[language=Nit, linerange=6-7, firstnumber=last]{./syntaxe/listings/array_c.nit}\r
-\r
-Attention, en Nit, la première case du tableau est la case 0 !\r
-\r
-\subsection{Parcours d'un tableau}\r
-On peut parcourir les tableaux grâce Ã  une boucle |for| :\r
-\lstinputlisting[language=Nit, linerange=3-5, firstnumber=last]{./syntaxe/listings/array2_c.nit}\r
-\r
-\subsection{Initialisation explicite d'un tableau}\r
-Il existe une manière plus rapide de créer les tableaux en initialisant explicitement le tableau avec les valeurs qu'il doit contenir.\r
-\r
-\lstinputlisting[language=Nit, linerange=1]{./syntaxe/listings/array2_c.nit}\r
-\r
-%\section{Intervalles}\r
-%TODO vérifier et faire\r
-%Il est possible de déclarer des intervalles |Range| basés sur des types discrets (comme |Int| par exemple). Il existe deux types d'intervalles : les intervalles ouverts |[1..5[| qui excluent le dernier Ã©lément, et les intervalles fermés |[1..5]| qui incluent le dernier Ã©lément.\r
-\r
-%Par exemple :\r
-\r
-\r
-\section{Conversions de types}\r
-En Nit, il n'existe pas de mot clé de transtypage. Les conversions de types se font par des méthodes. La bibliothèque standard fournit une série de classes qui contiennent des méthodes de manipulation et de conversion de types.\r
-\r
-\begin{tabularx}{\linewidth}{|c|X|}\r
-       \hline\r
-       \textbf{Classe} & \textbf{Rôle} \\\r
-       \hline\r
-       \textit{Char} & pour les caractères \\\r
-       \hline\r
-       \textit{String} & pour les chaînes de caractères \\\r
-       \hline\r
-       \textit{Int} & pour les entiers \\\r
-       \hline\r
-       \textit{Float} & pour les nombres Ã  virgule flottante \\\r
-       \hline\r
-\end{tabularx}\r
-\r
-Par exemple la classe \textit{Int} propose les méthodes suivantes :\r
-\begin{description}\r
-       \item[Int.to\_c: Char] Retourne le caractère correspondant.\r
-       \item[Int.to\_f: Float] Retourne l'entier sous forme de |Float|.\r
-       \item[Int.to\_s: String] Retourne l'entier sous forme de |String|.\r
-\end{description}\r
-\r
-\section{Manipulation de chaînes de caractères}\r
-\subsection{Char et String}\r
-La définition d'un caractère se fait grâce au type |Char|.\r
-\r
-Pour assigner explicitement un caractère Ã  une variable de type |Char|, il faut utiliser l'apostrophe |'|.\r
-\r
-\lstinputlisting[language=Nit]{./syntaxe/listings/char1_c.nit}\r
-\r
-La définition d'une chaine de caractères se fait grâce au type |String|.\r
-\r
-Pour assigner explicitement un caractère Ã  une variable de type |String|, il faut utiliser les guillemets |"|.\r
-\r
-\lstinputlisting[language=Nit, linerange=1-1]{./syntaxe/listings/string_c.nit}\r
-\r
-Les variables de type |Char| et |String| sont des objets. Partout où des constantes de caractères ou de chaînes figurent entre guillemets, le compilateur Nit génère l'objet correspondant avec le contenu spécifié. Il est donc possible d'écrire :\r
-\lstinputlisting[language=Nit, linerange=3-3, firstnumber=last]{./syntaxe/listings/string_c.nit}\r
-\r
-Bien que |Char| et |String| soient des classes, ils ne possèdent pas de constructeurs, il n'est donc pas possible de les initialiser en appelant la méthode |init|.\r
-\r
-Attention, Nit ne supporte que l'encodage UTF-8 !\r
-\r
-\subsection{Caractères spéciaux}\r
-\r
-Dans une chaîne de caractères, plusieurs caractères particuliers doivent Ãªtre Ã©chappés grâce au caractère |\| pour Ãªtre utilisés. \r
-\r
-Le tableau ci-dessous recense les principaux caractères Ã  Ã©chapper :\r
-\r
-\begin{center}  \r
-  \begin{tabular}{|c|c|}\r
-      \hline\r
-      \textbf{Caractères spéciaux} & \textbf{Affichage} \\\r
-      \hline\r
-      ' & apostrophe \\\r
-      \hline\r
-      " & guillemet \\\r
-      \hline\r
-      \lstinline!\! & antislash \\\r
-      \hline\r
-      \lstinline!\t! & tabulation \\\r
-      \hline\r
-      \lstinline!\b! & retour arrière (backspace) \\\r
-      \hline\r
-      \lstinline!\r! & retour chariot \\\r
-      \hline\r
-      \lstinline!\f! & saut de page \\\r
-      \hline\r
-      \lstinline!\n! & saut de ligne \\\r
-      \hline\r
-  \end{tabular}\r
-\end{center}\r
-\r
-\subsection{Concaténation de chaînes de caractères}\r
-\r
-Il est possible de concaténer des chaînes de caractères Ã  l'aide  de l'opérateur |+| et de le combiner Ã  l'opérateur d'affectation |=|.\r
-\r
-\lstinputlisting[language=Nit, linerange=5-5, firstnumber=last]{./syntaxe/listings/string_c.nit}\r
-\r
-Pour concaténer un autre type avec un string, il faut faire appel Ã  la méthode |to_s|.\r
-\r
-Par exemple avec un Int :\r
-\lstinputlisting[language=Nit, linerange=7-7]{./syntaxe/listings/string_c.nit}\r
-\r
-Une notation particulière permet d'inclure une variable ou une expression dans une chaine de caractères :\r
-\lstinputlisting[language=Nit, linerange=9-10]{./syntaxe/listings/string_c.nit}\r
-\r
-La notation allégée appelle implicitement la méthode |to_s| sur les types autres que |String| :\r
-\lstinputlisting[language=Nit, linerange=12-12]{./syntaxe/listings/string_c.nit}\r
-\r
-La notation allégée sera préférée puisqu'elle est plus lisible mais aussi bien plus performante car traitée différemment pas le compilateur.\r
-\r
-\subsection{Comparaison de chaînes de caractères}\r
-\r
-En Nit il est possible de comparer deux chaînes de caractères directement grâce Ã  l'opérateur |==|. Contrairement Ã  Java par exemple, Nit va comparer la valeur des objets String est non pas les références vers les objets.\r
-\lstinputlisting[language=Nit]{./syntaxe/listings/string2_c.nit}\r
-\r
-\subsection{Autres opérations sur les chaînes de caractères}\r
-Les méthodes |to_upper| et |to_lower| permettent respectivement d'obtenir une chaîne toute en majuscule ou toute en minuscule.\r
-\r
-La méthodes |length| permet d'obtenir la taille de la chaîne.\r
-\r
-On peut accéder aux caractères d'une chaine en utilisant la notation en tableau :\r
-\lstinputlisting[language=Nit]{./syntaxe/listings/string3_c.nit}\r
-\r
-Enfin, il est possible de répéter une chaine de caractères grâce Ã  l'opérateur de multiplication |*| :\r
-\lstinputlisting[language=Nit]{./syntaxe/listings/string4_c.nit}\r
-\r
-\chapter{Typage Adaptatif}\r
-\label{typage-adaptatif}\r
-Nit est le premier langage Ã  introduire la notion de \textbf{typage adaptatif}. Le principe est que le type statique d'une variable peut changer en fonction de l'assignation des variables et du contrôle de flot.\r
-\r
-Par exemple :\r
-\lstinputlisting[language=Nit]{./syntaxe/listings/typage_c.nit}\r
-\r
-Les instructions de contrôle de flot vont elles aussi agir sur le typage de la variable :\r
-\lstinputlisting[language=Nit]{./syntaxe/listings/typage2_c.nit}\r
-\r
-Le typage adaptatif fonctionne aussi avec les types nullables :\r
-\lstinputlisting[language=Nit]{./syntaxe/listings/typage3_c.nit}
\ No newline at end of file
diff --git a/doc/nitreference/nitlanguage.sty b/doc/nitreference/nitlanguage.sty
deleted file mode 100644 (file)
index ef024ec..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-% This file is part of Nit ( http://www.nitlanguage.org ).
-%
-% Copyright 2011 Jean Privat <jean@pryen.org>
-%
-% Licensed under the Apache License, Version 2.0 (the "License");
-% you may not use this file except in compliance with the License.
-% You may obtain a copy of the License at
-%
-%     http://www.apache.org/licenses/LICENSE-2.0
-%
-% Unless required by applicable law or agreed to in writing, software
-% distributed under the License is distributed on an "AS IS" BASIS,
-% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-% See the License for the specific language governing permissions and
-% limitations under the License.
-
-\usepackage{lmodern} % because there is a bizarre 'pdfTeX error (font expansion): auto expansion is only possible with scalable fonts' unless
-\usepackage{listings} % because we extends it
-\usepackage{xcolor} % because we like colors
-
-% definition of the nit language
-\lstdefinelanguage{nit}{%
-keywords={import,class,interface,universal,super,fun,var,redef,protected,private,module,init,do,end,new,%
-               return,if,then,else,while,for,loop,in,isa,isset,break,continue,label,%
-               is,abstract,self,true,false,null,nullable,writable,assert,and,or,not,extern,intern},%
-morecomment=[l]{\#},%
-morestring=[b]",%
-}
-
-% disable spaces ij strings by default
-\lstset{showstringspaces=false}
-
-% easy nice environement for nit listings
-\lstnewenvironment{lst}[1][]{%
-       \lstset{basicstyle=\scriptsize\ttfamily,%
-       keywordstyle=\bf\color{blue!30!black},%
-       commentstyle=\itshape\color{green!30!black},%
-       language=nit,%
-       backgroundcolor=\color{black!10},%
-       moredelim=[is][\color{yellow!30!black}]{@}{@},%
-       tabsize=3,%
-       #1}}{}
-
-% makes @ a nice shortcut for inline Nit code
-%\lstMakeShortInline[basicstyle=\small\ttfamily\color{blue!30!black}]{@}
-
diff --git a/doc/nitreference/nitreference-main.tex b/doc/nitreference/nitreference-main.tex
deleted file mode 100644 (file)
index 22288a0..0000000
+++ /dev/null
@@ -1,1738 +0,0 @@
-% This file is part of Nit ( http://www.nitlanguage.org ).
-%
-% Copyright 2011 Jean Privat <jean@pryen.org>
-%
-% Licensed under the Apache License, Version 2.0 (the "License");
-% you may not use this file except in compliance with the License.
-% You may obtain a copy of the License at
-%
-%     http://www.apache.org/licenses/LICENSE-2.0
-%
-% Unless required by applicable law or agreed to in writing, software
-% distributed under the License is distributed on an "AS IS" BASIS,
-% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-% See the License for the specific language governing permissions and
-% limitations under the License.
-\noindent\textbf{A Concise Reference of the Nit Language}
-
-This document attempts to be as short as possible while covering all features of the language in deepth.
-It is not a real manual to learn the language since concepts are covered when required.
-Forward and backward references about concepts are written like this~\goto{redef} which means Section~\ref*{redef}.
-An index\goto{index} also lists concepts and keywords for an improved navigation.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Basic Syntax}\label{syntax}\label{end}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-The syntax of Nit belongs to the Pascal tradition and is inspired by various script languages (especially Ruby).
-Its objective is readability.
-
-Indentation is not meaningful in Nit; blocks usually starts by a specific keyword and finish with @end@.
-Newlines are only meaningful at the end of declarations, at the end of statements, and after some specific keywords.
-The philosophy is that the newline is ignored if something (a statement, a declaration, or whatever) obviously needs more input; while the newline terminates lines that seems completed.
-See the complete Nit grammar for more details.
-
-\begin{lst}
-print 1 + 1 # a first complete statement that outputs "2"
-print 2 + # the second statement is not yet finished
-2 # the end of the second statement, outputs "4"
-\end{lst}
-
-Nit tries to achieve some uniformity in its usage of the common punctuation:
-equal (@=@) is for assignment,
-double equal (@==@) is for equality test\goto{Bool}, 
-column (@:@) is for type declaration,
-dot (@.@) is for polymorphism\goto{call},
-comma (@,@) separates elements,
-and quad (@::@) is for explicit designation.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Identifiers}\label{identifier}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Identifiers of modules, variables, methods, attributes and labels must begin with a lowercase letter and can be followed by letters, digits, or underscores.
-However, the usage of uppercase letters (and camelcase) is discouraged and the usage of underscore to separate words in identifiers is preferred: @some_identifier@.
-
-Identifiers of classes and types must begin with a uppercase letter and can be followed by letters, digits, or underscores.
-However, in classes, the usage of camelcase is preferred while formal types should be written all in uppercases: @SomeClass@ and @SOME_VIRTUAL_TYPE@.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Style}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-While Nit does not enforce any kind of source code formatting, the following is encouraged:
-\begin{itemize}
-\item indentation is done with the tabulation character and is displayed as 8 spaces;
-\item lines are less than 80 characters long;
-\item binary operators have spaces around them: @4 + 5@, @x = 5@;
-\item columns (@:@) and commas (@,@) have a space after them but not before: @var x: X@, @[1, 2, 3]@;
-\item parenthesis and brackets do not need spaces around them;
-\item superfluous parenthesis should be avoided;
-\item the @do@ of methods\goto{fun} and the single @do@\goto{do} is on its own line and not indented;
-\item the other @do@ are not on a newline.
-\end{itemize}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Comments and Documentation}\label{comment}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-As in many script languages, comments begin with a sharp (@#@) and run up to the end of the line.
-Currently, there is no multiline-comments.
-
-A block of comments that precede any definition of module, class, or property, is considered as its documentation and will be displayed as such by the autodoc.
-At this point, documentation is displayed verbatim (no special formatting or meta-information).
-
-\begin{lst}
-# doc. of foo
-module foo
-
-# doc. of Bar
-class Bar
-       # doc. of baz
-       fun baz ...
-end
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Types, Literals and Operations}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Object}\label{Object}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Nit is a full object language.
-Each value is the instance of a class\goto{class}.
-Even the basic types described in this section.
-
-@Object@ is the root of the class hierarchy.
-All other classes, including the basic ones, are a specialization of @Object@.
-\goto{superclass}
-
-Classes\goto{class}, methods\goto{fun} and operators\goto{operator} presented in this section are defined in the standard Nit library that is implicitly imported in every module\goto{module}.
-Many other classes and methods are also defined in the standard library.
-Please look at the specific standard library documentation for all details.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Int and Float}\label{Int}\label{Float}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@1@, @-1@ are @Int@ literals, and @1.0@, @-0.1@ are @Float@ literals.
-Standard arithmetic operators are available with a common precedence rules: @*@, @/@, and @%@ (modulo) ; then @+@ and @-@. 
-Some operators can be composed with the assignment (@=@). \goto{operator}
-\begin{lst}
-var i = 5
-i += 2
-print i # outputs 7
-\end{lst}
-
-Conversion from @Int@ to @Float@ and @Float@ to @Int@ must be done with the @to_f@ and @to_i@ methods.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{String}\label{String}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Literal strings are enclosed within quotes (@"@).
-Common escaping sequences are available (@\n@, @\t@, etc.)
-To insert a value inside a literal string, include the values inside brackets (@{}@).
-@+@ is the concatenation operator but is less efficient than the bracket form.
-
-\begin{lst}
-var i = 5
-print "i={i}; i+1={i+1}" # outputs "i=5; i+1=6"
-\end{lst}
-
-All objects have a @to_s@ method that converts the object to a String.
-@print@ is a top-level method\goto{toplevel} that takes any number of arguments\goto{vararg} and prints to the standard output.
-@print@ always add a newline, another top-level method, @printn@, does not add the newline.
-
-\begin{lst}
-var x: String
-x = 5.to_s # -> the String "5"
-print x, 6 # outputs "56"
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Bool}\label{Bool}\label{is}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@true@ and @false@ are the only two @Bool@ values.
-Standard Boolean operators are available with the standard precedence rule: @not@; then @and@; then @or@.
-
-Common comparison operators are available: @==@ and @!=@ on all objects; @<@, @>@, @<=@, @>=@ and @<=>@ on @Comparable@ objects (which include @Int@, @String@ and others). \goto{operator}
-
-\begin{itemize}
-\item @==@, @<@, @>@, @<=@, @>=@ and @<=>@ are standard Nit operators (it means they are redefinable)\goto{operator}.
-\item @and@, @or@ and @not@ are not standard Nit operators: they are not redefinable, also they are lazy and have adaptive typing flow effects\goto{adaptive typing}.
-\item @==@ is not for reference equality but for value equality (like @equals@ in Java).
-There is a special reference equality operator, @is@, but it cannot be redefined and its usage is not recommended.
-Note also that while @==@ is redefinable, it has a special adaptive typing flow effect when used with @null@\goto{null}.
-\item @!=@ is not a standard Nit operator. In fact @x != y@ is syntactically equivalent to @not x == y@.
-\end{itemize}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Array}\label{Array}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@Array@ is a generic class\goto{generic}, thus @Array[Int]@ denotes an array of integers and @Array[Array[Bool]]@ denotes an array of array of Booleans.
-Literal arrays can be declared with the bracket notation (@[]@).
-Empty arrays can also be instantiated with the @new@\goto{new} keyword and elements added with the @add@ method.
-Elements can be retrieved or stored with the bracket operator\goto{operator}.
-
-\begin{lst}
-var a = [1, 2, 3, 4] # A literal array of integers
-print a.join(":") # outputs "1:2:3:4"
-var b = new Array[Int] # A new empty array of integers
-b.add(10)
-b.add_all(a)
-b.add(20)
-print b[0] # outputs "10"
-print b.length # outputs "6"
-b[1] = 30
-print b.join(", ") # outputs "10, 30, 2, 3, 4, 20"
-\end{lst}
-
-Note that the type of literal arrays is deduced using the static type combination rule\goto{combination}.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Range}\label{Range}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@Range@ is also a generic class but accepts only @Discrete@ types (@Int@ is discrete).
-There are two kinds of literal ranges, the open one @[1..5[@ that excludes the last element, and the closed one @[1..5]@ that includes it.
-
-\begin{lst}
-print([1..5[.join(":")) # outputs "1:2:3:4"
-print([1..5].join(":")) # outputs "1:2:3:4:5"
-\end{lst}
-
-Ranges are mainly used in @for@ loops\goto{for}.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{HashMap}\label{HashMap}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@HashMap@ is a generic class that associates keys with values.
-There is no literal hashmap, therefore the @new@\goto{new} keyword is used to create an empty @HashMap@ and the bracket operators\goto{operator} are used to store and retrieve values.
-
-\begin{lst}
-var h = new HashMap[String, Int] 
-# h associates strings to integers
-h["six"] = 6
-print h["six"] + 1 # outputs "7"
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Control Structures}\label{control}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Traditional procedural control structures exist in Nit.
-They also often exist in two versions: a one-liner and a block version.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Control Flow}\label{control flow}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Control structures dictate the control flow of the program.
-Nit heavily refers to the control flow in its specification:
-\begin{itemize}
-\item No unreachable statement;
-\item No usage of undefined variables\goto{var};
-\item No function without a @return@ with a value\goto{fun};
-\item Adaptive typing\goto{adaptive typing}.
-\end{itemize}
-
-Some structures alter the control flow but are not described in this section: @and@, @or@, @not@\goto{Bool}, @or else@\goto{or else} and @return@\goto{return}.
-
-Note that the control flow is determined only from the position, the order and the nesting of the control structures.
-The real value of the expressions used has no effect on the control flow analyses.
-\begin{multicols}{2}
-\begin{lst}
-if true then
-       return
-else
-       return
-end
-print 1
-# Compile error: 
-# unreachable statement
-\end{lst}
-\columnbreak
-\begin{lst}
-if true then
-       return
-end
-print 1
-# OK, but never executed
-\end{lst}
-\end{multicols}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{if}\label{if}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\begin{multicols}{2}
-\begin{lst}
-if exp then stm
-if exp then stm else stm
-if exp then
-       stms
-end
-\end{lst}
-\columnbreak
-\begin{lst}
-if exp then
-       stms
-else if exp then
-       stms
-else
-       stms
-end
-\end{lst}
-\end{multicols}
-Note that the following example is invalid since the first line is syntactically complete thus the newline terminate the whole @if@ structure\goto{syntax}; then an error is signaled since a statement cannot begin with @else@.
-\begin{lst}
-if exp then stm # OK: complete 'if' structure
-else stm # Syntax error: unexpected 'else'
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{while}\label{while}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\begin{lst}
-while exp do stm
-while exp do
-       stms
-end
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{for}\label{for}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@for@ declares an automatic variable\goto{var} used to iterates on @Collection@ (@Array@ and @Range@ are both @Collection@).
-
-\begin{lst}
-for x in [1..5] do print x # outputs 1 2 3 4 5
-for x in [1, 4, 6] do
-       print x # outputs 1 4 6
-end
-\end{lst}
-
-In fact, @for@ is syntactic sugar for a closure\goto{closure}.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{loop}\label{loop}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Infinite loops are mainly used with breaks.
-They are useful to implement \textit{until} loops or to simulate the \textit{exit when} control of Ada.
-
-\begin{lst}
-loop
-       stms
-       if exp then break
-       stms
-end
-\end{lst}
-
-Note that @loop@ is different from @while true@ because the control flow does not consider the values of expression\goto{control flow}.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{do}\label{do}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Single @do@ are used to create scope for variables or to be attached with labeled breaks.
-
-\begin{lst}
-do
-       var x = 5
-       print x
-end
-# x is not defined here
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{break, continue and label}\label{break}\label{continue}\label{label}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Unlabeled @break@ exits the current @for@, @while@, @loop@, or closure\goto{closure}.
-Unlabeled @continue@ skips the current @for@, @while@, @loop@, or closure.
-
-@label@ can be used with @break@ or @continue@ to act on a specific control structure (not necessary the current one). 
-The corresponding @label@ must be defined after the @end@ keyword of the designated control structure.
-
-\begin{lst}
-for i in [0..width[ do
-       for j in [0..height[ do
-               if foo(i, j) then break label outer_loop
-               # The 'break' breaks the 'for i' loop
-       end
-end label outer_loop
-\end{lst}
-
-@label@ can also be used with @break@ and single @do@ structures.
-
-\begin{lst}
-do
-       stmts
-       if expr then break label block
-       stmts
-end label block
-\end{lst}
-
-In closures, @break@ and @continue@ can return values\goto{closure return}.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{abort}\label{abort}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@abort@ stops the program with a fatal error and prints a stack trace.
-Since there is currently no exception nor run-time-errors, abort is somewhat used to simulate them.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{assert}\label{assert}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@assert@ verifies that a given Boolean expression is true, or else it aborts.
-An optional label can be precised, it will be displayed on the error message.
-An optional @else@ can also be added and will be executed before the abort.
-\begin{lst}
-assert bla: whatever else
-       # "bla" is the label
-       # "whatever" is the expression to verify
-       print "Fatal error in module blablabla."
-       print "Please contact the customer service."
-end
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Local Variables and Static Typing}\label{var}\label{static type}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@var@ declares local variables.
-In fact there is no global variable in Nit, so in this document \textit{variable} always refers to a local variable.
-A variable is visible up to the end of the current control structure.
-Two variables with the same name cannot coexist: no nesting nor masking.
-
-Variables are bound to values.
-A variable cannot be used unless it has a value in all control flow paths (\`a la Java).
-
-\begin{lst}
-var x
-var y
-if whatever then
-       x = 5
-       y = 6
-else
-       x = 7
-end
-print x # OK
-print y # Compile error: y is possibly not initialized
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Adaptive Typing}\label{adaptive typing}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Nit features adaptive typing, which means that the static type of a variable can change according to:
-the assignments of variables,
-the control flow\goto{control flow},
-and some special operators (@and@, @or@\goto{Bool}, @or else@\goto{or else}, @==@, @!=@\goto{null}, and @isa@\goto{isa}).
-
-\begin{multicols}{2}
-\begin{lst}
-var x # a variable
-x = 5
-# static type is Int
-print x + 1 # outputs 6
-x = [6, 7]
-# static type is Array[Int]
-print x[0] # outputs "6"
-\end{lst}
-\columnbreak
-\begin{lst}
-var x
-if whatever then
-       x = 5
-else
-       x = 6
-end
-# Static type is Int
-\end{lst}
-\end{multicols}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Variable Upper Bound}\label{upper bound}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-An optional type information can be added to a variable declaration.
-This type is used as an upper bound of the type of the variable.
-When a initial value is given in a variable declaration without a specific type information, the static type of the initial value is used as an upper bound.
-If no type and no initial value are given, the upper bound is set to @nullable Object@\goto{null}.
-
-\begin{lst}
-var x: Int # Upper bound is Int
-x = "Hello" # Compile error: expected Int
-var y: Object # Upper bound is Object
-y = 5 # OK since Int specializes Object
-var z = 5 # Upper bound is Int
-z = "Hello" # Compile error: expected Int
-var t: Object = 5 # Upper bound is Object
-t = "Hello" # OK
-\end{lst}
-
-The adaptive typing flow is straightforward, therefore loops (@for@\goto{for}, @while@\goto{for}, @loop@\goto{for}) and closures\goto{closure} have a special requirement: on entry, the upper bound is set to the current static type; on exit, the upper bound is reset to its previous value.
-
-\begin{lst}
-var x: Object = ...
-# static type is Object, upper bound is Object
-x = 5
-# static type is Int, bound remains Object
-while x > 0 do
-       # static type remains Int, bound sets to Int
-       x -= 1 # OK
-       x = "Hello" # Compile error: expected Int
-end
-# static type is Int, bound reset to Object
-x = "Hello" # OK
-\end{lst}
-
-\future{A possible future version of Nit will use a fixed point analysis, thus remove the need of resetting the upper bound.}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Type Checks}\label{isa}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@isa@ tests if an object is an instance of a given type.
-If the expression used in an @isa@ is a variable, then its static type is automatically adapted, therefore avoiding the need of a specific cast\goto{as}.
-
-\begin{lst}
-var x: Object = whatever
-if x isa Int then
-       # static type of x is Int
-       print x * 10 # OK
-end
-\end{lst}
-
-Remember that adaptive typing follows the control flow\goto{control flow}, including the Boolean operators\goto{Bool}.
-
-\begin{lst}
-var a: Array[Object] = ...
-for i in a do
-       # the static type of i is Object 
-       if not i isa Int then continue
-       # now the static type of i is Int
-       print i * 10 # OK
-end
-\end{lst}
-
-An interesting example:
-\begin{lst}
-var max = 0
-for i in whatever do
-       if i isa Int and i > max then max = i
-       # the > is valid since, in the right part
-       # of the "and", the static type of i is Int
-end
-\end{lst}
-
-Note that type adaptation occurs only in an @isa@ if the target type is more specific that the current type.
-\begin{lst}
-var a: Collection[Int] = ...
-if a isa Comparable then
-       # the static type is still Collection[Int]
-       # even if the dynamic type of a is a subclass
-       # of both Collection[Int] and Comparable
-       ...
-end
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Nullable Types}\label{null}\label{nullable}\label{or else}\label{not null}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@null@ is a literal value that is only accepted by some specific static types.
-However, thanks to adaptive typing, the static type management can be mainly automatic.
-
-@nullable@ annotates types that can accept @null@ or an expression of a compatible nullable static type.
-
-\begin{lst}
-var x: nullable Int
-var y: Int
-x = 1 # OK
-y = 1 # OK
-x = null # OK
-y = null # Compile error
-x = y # OK
-y = x # Compile error
-\end{lst}
-
-Adaptive typing works well with nullable types.
-
-\begin{lst}
-var x
-if whatever then
-       x = 5
-else
-       x = null
-end
-# The static type of x is nullable Int
-\end{lst}
-
-Moreover, like the @isa@ keyword, the @==@ and @!=@ operators can adapt the static type of a variable when compared to @null@.
-
-\begin{lst}
-var x: nullable Int = whatever
-if x != null then
-       # The static type of x is Int (without nullable)
-       print x + 6
-end
-# The static type of x is nullable Int
-\end{lst}
-
-And another example:
-\begin{lst}
-var x: nullable Int = whatever
-loop
-       if x == null then continue
-       # The static type of x is Int
-end
-\end{lst}
-
-%FIXME: Pas clair il parrait
-@or else@ can be used to compose a nullable expression with any other expression.
-The value of @x or else y@ is @x@ if @x@ is not @null@ and is @y@ if @x@ is null.
-The static type of @x or else y@ is the combination\goto{combination} of the type of @y@ and the not null version of the type of @x@.
-\begin{lst}
-var i: nullable Int = ...
-var j = i or else 0
-# the static type of j is Int (without nullable)
-\end{lst}
-
-Note that nullable types require a special management for attributes and constructors\goto{initialization}.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Explicit Cast}\label{as}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@as@ casts an expression to a type.
-The expression is either casted successfully or there is an @abort@\goto{abort}.
-
-\begin{lst}
-var x: Object = 5 # static type of x is Object
-print x.as(Int) * 10 # outputs 50
-print x.as(String) # aborts: cast failed
-\end{lst}
-
-Note that @as@ does not change the object nor does perform conversion.
-\begin{lst}
-var x: Object = 5 # static type of x is Object
-print x.as(Int) + 10 # outputs "15"
-print x.to_s + "10" # outputs "510"
-\end{lst}
-
-
-Because of type adaptation, @as@ is rarely used on variables.
-@isa@ (sometime coupled with @assert@\goto{assert}) is preferred.
-\begin{lst}
-var x: Object = 5 # static type of x is Object
-assert x isa Int
-# static type of x is now Int
-print x * 10 # outputs 50
-\end{lst}
-
-@as(not null)@ can be used to cast an expression typed by a nullable type to its non nullable version.
-This form keeps the programmer from writing explicit static types.
-
-\begin{lst}
-var x: nullable Int = 5 # static type of x is nullable Int
-print x.as(not null) * 10 # cast, outputs 50
-print x.as(Int) * 10 # same cast, outputs 50
-assert x != null # same cast, but type of x is now Int
-print x * 10 # outputs 50
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Static Type Combination Rule}\label{combination}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Adaptive typing, literal arrays\goto{Array}, @or else@\goto{or else}, and valued @break@ in closure\goto{closure} need to determine a static type by combining other static types.
-This is done by using the following rule:
-\begin{itemize}
-\item The final type is @nullable@ if at least one of the types is @nullable@.
-\item The final type is the static type that is more general than all the other types.
-\item If there is no such a type, and the thing typed is a variable, then the final type is the upper bound type of the variable; else there is a compilation error.
-\end{itemize}
-% FIXME: the 'thing' typed?!
-
-\begin{lst}
-var d: Discrete = ...
-# Note: Int < Discrete < Object
-var x
-if whatever then x = 1 else x = d
-# static type is Discrete
-if whatever then x = 1 else x = "1"
-# static type is nullable Object (upper bound)
-var a1 = [1, d] # a1 is a Array[Discrete]
-var a2 = [1, "1"] # Compile error:
-               # incompatible types Int and String 
-\end{lst}
-
-\future{A possible future version of Nit will introduce union types, thus simplifying the rule of combination.}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Modules}\label{module}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@module@ declares the name of a module.
-While optional it is recommended to use it, at least for documentation purpose\goto{comment}.
-The basename of the source file must match the name declared with @module@.
-The extension of the source file must be @nit@.
-
-A module is made of, in order:
-\begin{itemize}
-\item the module declaration;
-\item module importations;
-\item class definitions (and refinements) \goto{class};
-\item top-level function definitions (and redefinitions) \goto{toplevel};
-\item main instructions \goto{toplevel}.
-\end{itemize}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Module Importation}\label{import}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@import@ declares dependencies between modules.
-By default, a module publicly imports the module @standard@.
-Dependencies must not produce cycles.
-By importing a module, the importer module can see and use classes and properties defined in the imported module.
-
-\begin{itemize}
-\item @import@ indicates a public importation.
-Importers of a given module will also import its publicly imported modules.
-%Modules that import the current module will implicitly also import the other module.
-An analogy is using @#include@ in a header file (@.h@) in C/C++.
-\item @private import@ indicates a private importation.
-Importers of a given module will not automatically import its privately imported modules.
-An analogy is using @#include@ in a body file (@.c@) in C/C++.
-%Modules that import the current module will not see the classes and properties imported.
-%However, while the classes and properties imported are invisible, the information that the module import an other one is still public and required to compile and run the program.
-\item @intrude import@ indicates an intrusive importation.
-@intrude@ @import@ bypasses the @private@ visibility and gives to the importer module a full access on the imported module.
-Such an import may only be considered when modules are strongly bounded and developed together.
-The closest, but insufficient, analogy is something like including a body file in a body file in C/C++.
-\end{itemize}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Visibility}\label{visibility}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-By default, all classes\goto{class}, methods\goto{fun}, constructors\goto{init} and virtual types\goto{type} are public which means freely usable by any importer module.
-Once something is public it belongs to the API of the module and should not be changed.
-
-@private@ indicates classes and methods that do not belong to the API.
-They are still freely usable inside the module but are invisible in other modules (except those that use @intrude import@).
-
-@protected@ indicates restricted methods and constructors.
-Such methods belong to the API of the module but they can only be used with the @self@ receiver.
-Basically, @protected@ methods are limited to the current class and its subclasses.
-Note that inside the module (and in intrude importers), there is still no restriction.
-
-Visibility of attributes is more specific and is detailed in its own section\goto{attribute visibility}.
-
-\begin{multicols}{2}
-\begin{lst}
-module m1
-class Foo
-       fun pub do ...
-       protected fun pro
-       do ...
-       private fun pri
-       do ...
-end
-private class Bar
-       fun pri2 do ...
-end
-var x: Foo = ...
-var y: Bar = ...
-# All OK, it is
-# inside the module
-x.foo
-x.pro
-x.pro
-y.pri2
-\end{lst}
-\columnbreak
-\begin{lst}
-module m2
-import m1
-class Baz
-       super Foo
-       fun derp
-       do
-               self.pro # OK
-       end
-end
-var x: Foo = ...
-x.pub # OK
-x.pro # Compile error:
-      # pro is protected
-x.pri # Compile error:
-      # unknown method pro
-
-var y: Bar
-# Compile error:
-# unknown class Bar
-\end{lst}
-\end{multicols}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Visibility Coherence}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-In order to guarantee the coherence in the visibility, the following rules apply:
-\begin{itemize}
-\item Classes and properties privately imported are considered private: they are not exported and do not belong to the API of the importer.
-\item Properties defined in a private class are private.
-\item A static type is private if it contains a private class or a private virtual type\goto{type}.
-\item Signatures of public and protected properties cannot contain a private static type.
-\item Bounds of public generic class\goto{generic} and public virtual types\goto{type} cannot contain a private static type.
-\end{itemize}
-
-% FIXME: What about specialization links between a public class and a privately imported public class
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Classes}\label{class}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@interface@, @abstract class@, @class@ and @enum@ are the four kinds of classes. All these classes can be in multiple inheritance, can define new methods and redefine inherited method (yes, even interfaces). Here are the differences:
-\begin{itemize}
-\item interfaces can only specialize other interfaces, cannot have attributes, cannot have constructors, cannot be instantiated.
-\item abstract classes cannot specialize enums, can have attributes, must have constructors, cannot be instantiated.
-\item concrete classes (i.e. @class@) cannot specialize enums, can have attributes, must have constructors, can be instantiated.
-\item enums (e.g. @Int@ or @Bool@) can only specialize interfaces, cannot have attributes, cannot have constructors, have proper instances but they are not instantiated by the programmer---it means no @new Int@. Note that at this point there is no user-defined enums.
-\end{itemize}
-
-All kinds of classes must have a name, can have some superclasses and can have some definitions of properties.
-Properties are methods\goto{fun}, attributes\goto{attribute}, constructors\goto{init} and virtual types\goto{type}.
-All kinds of classes can also be generic\goto{generic}.
-When we talk about ``classes'' in general, it means all these four kinds.
-We say ``concrete classes'' to designate only the classes declared with the @class@ keyword alone.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Class Specialization}\label{superclass}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@super@ declares superclasses.
-Classes inherit methods, attributes and virtual-types defined in their superclasses.
-Currently, constructors are inherited in a specific manner\goto{init inheritance}.
-
-@Object@ is the root of the class hierarchy.
-It is an interface and all other kinds of classes are implicitly a subclass of @Object@.
-
-There is no repeated inheritance nor private inheritance.
-The specialization between classes is transitive, therefore @super@ declarations are superfluous (thus ignored).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Class Refinement}\label{refine}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@redef@ allows modules to refine imported classes (even basic ones).
-Refining a class means:
-\begin{itemize}
-\item adding new properties: methods, attributes, constructors, virtual types;
-\item redefining existing properties: methods and constructors;
-\item adding new superclasses.
-\end{itemize}
-
-Note that the kind\goto{class} or the visibility\goto{visibility} of a class cannot be changed by a refinement.
-Therefore, it is allowed to just write @redef class X@ whatever is the kind or the visibility of @X@.
-
-In programs, the real instantiated classes are always the combination of all their refinements.
-%This is quite powerful and permit a programing style only found in some dynamically typed languages or aspect-oriented languages.
-
-\begin{lst}
-redef class Int
-       fun fib
-       do
-               if self < 2 then return self
-               return (self-1).fib + (self-2).fib
-       end
-end
-# Now all integers have the fib method
-print 15.fib # outputs 610
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Methods}\label{fun}\label{self}\label{return}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@fun@ declares methods.
-Methods must have a name, may have parameters, and may have a return type.
-Parameters are typed; however, a single type can be used for multiple parameters.
-\begin{lst}
-fun foo(x, y: Int, s: String): Bool ...
-\end{lst}
-
-@do@ declares the body of methods.
-Alike control structures\goto{control}, a one-liner version is available.
-Moreover, a shorter version using the @=@ symbol is also available for functional methods.
-Therefore, the three following methods are equivalent. 
-\begin{lst}
-fun next1(i: Int): Int
-do
-       return i + 1
-end
-
-fun next2(i: Int): Int do return i + 1
-
-fun next3(i: Int): Int = i + 1
-\end{lst}
-
-Inside the method body, parameters are considered as variables\goto{var}.
-They can be assigned and are subject to adaptive typing.
-
-@self@, the current receiver, is a special parameter.
-It is not assignable but is subject to adaptive typing.
-
-@return@ exits the method and returns to the caller.
-In a function, the return value must be provided with a return in all control flow paths\goto{control flow}.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Method Call}\label{call}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Calling a method is usually done with the dotted notation @x.foo(y, z)@.
-The dotted notation can be chained.
-
-A method call with no argument does not need parentheses.
-Moreover, even with arguments, the parentheses are not required in the principal method of a statement.
-\begin{lst}
-var a = [1]
-a.add 5 # no () for add
-print a.length # no () for length, no () for print
-\end{lst}
-
-However, this last facility requires that the first argument does not start with a parenthesis or a bracket.
-\begin{lst}
-foo (x).bar # will be interpreted as (foo(x)).bar
-foo [x].bar # will be interpreted as (foo[x]).bar
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Method Redefinition}\label{redef}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@redef@ denotes methods that are redefined in subclasses\goto{superclass} or in class refinements\goto{refine}.
-The number and the types of the parameters must be invariant.
-Thus, there is no need to reprecise the types of the parameters, only names are mandatory.
-
-The return type can be redefined to be a more precise type.
-If same type is returned, there is no need to reprecise it.
-
-The visibility, also, cannot be changed, thus there is also no need to reprecise it.
-
-\begin{lst}
-class Foo
-       # implicitly an Object
-       # therefore inherit '==' and 'to_s' 
-       var i: Int
-       redef to_s do return "Foo{self.i}"
-       redef ==(f) do return f isa Foo and f.i == self.i
-end
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Abstract Methods}\label{abstract}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@is abstract@ indicates methods defined without a body.
-Subclasses and refinements can then redefine it (the @redef@ is still mandatory) with a proper body.
-
-\begin{lst}
-interface Foo
-       fun derp(x: Int): Int is abstract
-end
-class Bar
-       super Foo
-       redef derp(x) do return x + 1
-end
-\end{lst}
-
-Concrete classes may have abstract methods.
-It is up to a refinement\goto{refine} to provide a body.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Call to Super}\label{super}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@super@ calls the ``previous'' definition of the method.
-It is used in a redefinition of a method in a subclass or in a refinement,
-It can be used with or without arguments; in the latter case, the original arguments are implicitly used.
-
-The @super@ of Nit behave more like the @call-next-method@ of CLOS that the @super@ of Java or Smalltalk.
-It permits the traversal of complex class hierarchies and refinement.
-Basically, @super@ is polymorphic: the method called by @super@ is not only determined by the class of definition of the method but also by the dynamic type of @self@.
-
-\begin{comment}
-The principle it to produce a strict order of the redefinitions of a method (the linearization).
-Each call to @super@ call the next method definition in the linearization.
-From a technical point of view, the linearization algorithm used is based on C4.
-It ensures that:
-\begin{itemize}
-\item A definition comes after its redefinition.
-\item A redefinition in a refinement comes before a redefnition in a
-\item The order of the declaration of the superclasses is used as the ultimate deabiguization.
-\end{itemize}
-
-%@super@ is really powerful and can deals with very complex multiple inheritance and multiple refinement thanks to some linearization algorithm.
-
-\begin{lst}
-class A
-       fun derp: String do return "A"
-end
-class B
-       super A
-       redef fun derp do return "B" + super
-end
-class C
-       super A
-       redef fun derp do return "C" + super
-end
-class D
-       super B
-       super C
-       redef fun derp do return "D" + super
-       # Here the linearization order of the class D is DBCA
-       # D before B because D specializes B
-       # B before A because B specializes A 
-       # D before C because D specializes C
-       # C before A because C specializes A
-       # B before C because in D 'super B' is before 'super C'  
-end
-var b = new B
-print b.derp # outputs "BA"
-var d = new D
-print d.derp # outputs "DBCA"
-\end{lst}
-\end{comment}
-
-% TODO: linearization.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Operators and Setters}\label{operator}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Operators and setters are methods that require a special syntax for their definition and their invocation.
-
-\begin{itemize}
-\item binary operators: @+@, @-@, @*@, @/@, @\%@, @==@, @<@, @>@, @<=@, @>=@, @<<@, @>>@ and @<=>@.
-Their definitions require exactly one parameter and a return value.
-Their invocation is done with @x + y@ where @x@ is the receiver, @+@ is the operator, and @y@ is the argument.
-\item unary operator: @-@.
-Its definition requires a return value but no parameter.
-Its invocation is done with @-x@ where @x@ is the receiver.
-\item bracket operator: @[]@.
-Its definition requires one parameter or more and a return value.
-Its invocation is done with @x[y, z]@ where @x@ is the receiver, @y@ the first argument and @z@ the second argument.
-\item setters: @something=@ where @something@ can be any valid method identifier.
-Their definitions require one parameter or more and no return value.
-If there is only one parameter, the invocation is done with @x.something = y@ where @x@ is the receiver and y the argument.
-If there is more that one parameter, the invocation is done with @x.something(y, z) = t@ where @x@ is the receiver, @y@ the first argument, @z@ the second argument and @t@ the last argument.
-\item bracket setter: @[]=@.
-Its definition requires two parameters or more and no return value.
-Its invocation is done with @x[y, z] = t@ where @x@ is the receiver, @y@ the first argument, @z@ the second argument and @t@ the last argument.
-\end{itemize}
-
-\begin{lst}
-class Foo
-       fun +(a: Bar): Baz do ...
-       fun -: Baz do ...
-       fun [](a: Bar): Baz do ...
-       fun derp(a: Bar): Baz do ...
-       fun derp=(a: Bar, b: Baz) do ...
-       fun []= (a: Bar, b: Baz) do ...
-end
-var a: Foo = ...
-var b: Bar = ...
-var c: Baz = ...
-c = a + b
-c = -b
-c = a[b] # The bracket operator '[]'
-c = a.derp(b) # A normal method 'derp'
-a.derp(b) = c # A setter 'derp='
-a[b] = c # The bracket setter '[]='
-\end{lst}
-
-@+=@ and @-=@ are combinations of the assignment (@=@) and a binary operator.
-These feature are extended to setters where a single @+=@ is in fact three method calls: a function call, the operator call, then a setter call.
-\begin{lst}
-a += c # equiv. a = a + c
-a[b] += c # equiv. a[b] = a[b] + c
-a.foo += c # equiv. a.foo = a.foo + c
-a.bar(b) += c # equiv. a.bar(b) = a.bar(b) + c
-\end{lst} 
-
-% FIXME: priority of operators?
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Variable Number of Arguments}\label{vararg}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-A method can accept a variable number of arguments using ellipsis (@...@).
-The definition use @x: Foo...@ where @x@ is the name of the parameter and @Foo@ a type.
-Inside the body, the static type of @x@ is @Array[Foo]@.
-The caller can use 0, 1, or more arguments for the parameter @x@.
-Only one ellipsis is allowed in a signature.
-
-\begin{lst}
-fun foo(x: Int, y: Int..., z: Int)
-do
-       print "{x};{y.join(",")};{z}"
-end
-foo(1, 2, 3, 4, 5) # outputs "1;2,3,4;5"
-foo(1, 2) # outputs "1;;2"
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Top-level Methods and Main Body}\label{toplevel}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Some functions, like @print@, are usable everywhere simply without using a specific receiver.
-Such methods are just defined outside any classes.
-In fact, these methods are implicitly defined in the @Object@ interface, therefore inherited by all classes, therefore usable everywhere.
-However, this principle may change in a future version.
-
-In a module, the main body is a bunch of statements at the end of a file.
-The main body of the main module is the program entry point.
-In fact, the main method of a program is implicitly defined as the redefinition of the method @main@ of the @Sys@ class; and the start of the program is the implicit statement @(Sys.new).main@.
-Note that because it is a redefinition, the main part can use @super@\goto{super} to call the ``previous'' main part in the imported modules.
-If there is no main part in a module, it is inherited from imported modules.
-
-Top-level methods coupled with the main body can be used to program in a pseudo-procedural way.
-Therefore, the following programs are valid:
-\begin{multicols}{2}
-\begin{lst}
-print "Hello World!"
-\end{lst}
-\columnbreak 
-\begin{lst}
-fun sum(i, j: Int): Int
-do
-       return i + j
-end
-print sum(4, 5)
-\end{lst}
-\end{multicols}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Intern and Extern Methods}\label{intern}\label{extern}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@intern@ and @extern@ indicate concrete methods whose body is not written in Nit.
-
-The body of @intern@ methods is provided by the compiler itself for performance or bootstrap reasons.
-For the same reasons, some intern methods, like @+@ in @Int@\goto{Int} are not redefinable.
-
-The body of @extern@ methods is provided by libraries written in C; for instance, the system libraries required for input/output.
-Extern methods are always redefinable.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Attributes}\label{attribute}\label{writable}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@var@, used inside concrete and abstract classes, declares attributes.
-Attributes require a static type and can possibly have an initial value (it may be any kind of expression, even including @self@\goto{self})
-
-%In Nit, attributes cannot be directly accessed.
-%In fact by declaring an attribute, two methods are automatically generated.
-%One is the getter, the other is the setter.
-
-\begin{lst}
-class Foo
-       var i: Int = 5
-       fun dec(x: Int): Int
-       do
-               var k = self.i
-               if k > x then self.i = k - x else self.i = 0
-       end
-end
-\end{lst}
-
-Note that from an API point of view, there is no way to distinguish the read access of an attribute with a normal method neither to distinguish a write access of an attribute with a setter.
-Therefore, the read access of an attribute is called a getter while the write access is called a setter.
-\begin{lst}
-var x = foo.bar # Is bar an attribute or a method?
-foo.bar = y # Is bar an attribute or a setter?
-# In fact, we do not need to know.
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Visibility of Attributes}\label{attribute visibility}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-By default, a getter is public and a setter is private.
-The visibility of getters can be precised with the @private@ or @protected@ keywords.
-The visibility of setters can be specified with an additional @writable@ keyword.
-
-\begin{lst}
-class Foo
-       var pub_pri: X
-       protected var pro_pri: X
-       var pub_pub: X writable
-       private var pri_pro: X protected writable
-       var pub_pri2: X private writable # the default
-end
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Redefinition of Attributes}\label{redef var}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Getters and setters of attributes behave like genuine methods that can be inherited and redefined.
-Getters and setters can also redefine inherited methods.
-@redef var@ declares that the getter is a redefinition while @redef writable@ declares that the setter is a redefinition.
-
-\begin{lst}
-interface Foo
-       fun derp: Int is abstract
-       fun derp=(o: Int) is abstract
-end
-class Bar
-       super Foo
-       redef var derp: Int redef writable
-end
-class Baz
-       super Bar
-       redef fun derp do ...
-       redef fun derp=(o) do ...
-end
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Constructors and Instantiation}\label{init}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@init@ declares constructors in concrete and in abstract classes.
-The role of constructors is basically to initialize the attributes of the class.
-Constructors can have: a visibility (by default it is public), a name (by default, constructors are anonymous) and parameters.
-They cannot have a return value.
-
-\begin{lst}
-class Foo
-       init(i:Int) do ...
-       init herp do ...
-       init derp(i, j: Int) do ...
-end
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Class Instantiation}\label{new}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@new@ instantiates a concrete class using a specific constructor. 
-\begin{lst}
-var x = new Foo(4) # invoke init
-var y = new Foo.herp # invoke herp
-var z = new Foo.derp(1, 2) # invoke derp
-\end{lst}
-Note that syntactically, @new Bar@ means ``instantiate @Bar@ with the anonymous constructor'', and @new Bar.foo@ means ``instantiate @Bar@ with the constructor named @foo@'', but @(new Bar).foo@ means ``instantiate @Bar@ with the anonymous constructor then call the method @foo@ on the result''.
-
-Constructors can also be called by other constructors in order to factorize or delegate parts of the construction process.
-In other constructors, @init@ denotes the anonymous constructor.
-\begin{lst}
-class Foo
-       init(i: Int) do self.derp(i.to_s)
-       init herp do self.init(5)
-       init derp(s: String) do ...
-end
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Initialization of Attributes}\label{initialization}\label{isset}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-The tricky part in constructors is the initialization of attributes since they cannot be initialized in an atomic way.
-The various steps apply in the following order:
-\begin{itemize}
-\item Attributes typed by a nullable type are initialized with @null@\goto{null}; other attributes remain uninitialized.
-\item Default values of all attributes (including inherited ones) are computed in the order of their definitions.
-\item The constructor designated in the @new@ is executed.
-\item During the constructor execution (including any methods or other constructors called), accessing an uninitialized attribute aborts the program.
-\item After the execution of the constructor designated in the @new@, if some attributes remain uninitialized, the program aborts.
-\end{itemize}
-
-\begin{comment}
-@isset@ can be used to avoid aborting during the construction.
-It checks if an attribute is defined.
-\begin{lst}
-class Foo
-       var x: Int
-       fun safe_x: nullable Int
-       do
-               if isset self.x then
-                       return self.x
-               else
-                       return null
-               end
-       end
-       init
-       do
-               print safe_x or else 0 # outputs 0
-               # "print x" would have aborted the program
-               self.x = 5
-               print safe_x or else 0 # outputs "5"
-               print x # outputs "5". It is safe.
-       end
-end
-var f = new Foo
-\end{lst}
-\end{comment}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Free and Inherited Constructors}\label{init inheritance}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-When there is no constructor defined in a concrete class or in an abstract class that specializes only interfaces (@Object@ is always a superclass), a free anonymous constructor is implicitly declared.
-This free constructor gathers all attributes without a initial value and assign them in order.
-If all attributes have an initial value (or if there is no attributes), the free constructor has no parameters.
-
-\begin{lst}
-class Foo
-       var x: Int
-       var y: String
-       var z: Int = 0
-       # a free init(x: Int, y: String) is implicit
-end
-var f = new Foo(5, "five") # OK
-\end{lst}
-
-When there is no constructors defined in a concrete class or in an abstract class, and this class has only one direct superclass that is a concrete class or an abstract class, and all attributes defined in this class have an initial value, then all constructors of the superclass are inherited.
-
-\begin{lst}
-class Bar
-       super Foo
-       var t: String = "Hello"
-       # init(Int, String) is inherited
-end
-\end{lst}
-
-If none of these two cases apply, then there is a compilation error.
-The programmer usually has to define its own constructors for the class.
-
-\begin{lst}
-class Baz
-       super Foo
-       var u: Int
-       # Compile error: a constructor must be defined
-end
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Generic Classes and Virtual Types}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Generic Classes}\label{generic}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Generic classes are defined with formal generic parameters declared within brackets.
-Formal generic parameters can then be used as a regular type inside the class.
-Generic classes must always be qualified when used.
-
-\begin{lst}
-class Pair[E]
-       var first: E
-       var second: E
-       fun is_same: Bool
-       do
-               return self.first == self.second
-       end
-end
-var p1 = new Pair[Int](1, 2)
-print p1.second * 10 # outputs "20"
-print p1.is_same # outputs "false"
-var p2 = new Pair[String]("hello", "world")
-p2.first = "world"
-print p2.is_same # outputs "true"
-\end{lst}
-
-Unlike many object-oriented languages, generic classes in Nit yield a kind of sub-typing.
-For example, @Pair[Int]@ is a subtype of @Pair[Object]@.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Virtual Types}\label{type}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@type@ declares a virtual types in a class.
-A bound type is mandatory.
-Virtual types can then be used as regular types in the class and its subclasses.
-Subclasses can also redefine it with a more specific bound type.
-One can see a virtual type as an internal formal generic parameter or as a redefinable \textit{typedef}.
-
-\begin{lst}
-class Foo
-       type E: Object
-       var derp: E 
-end
-class Bar
-       super Foo
-       redef type E: Int
-end
-var b = new Bar(5)
-print b.derp + 1 # outputs 6
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Closures}\label{closure}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Closures are pieces of code that are passed to methods as additional arguments.
-Closures are defined and used with the @!@ character.
-The following example shows the use of the @sort@ method for arrays (defined in the Nit standard library).
-
-\begin{lst}
-var a = [4, 2, 9, 6]
-a.sort !cmp(x, y) = x <=> y
-print a.join(", ") # outputs "2, 4, 6, 9"
-a.sort !cmp(x, y) = y <=> x
-print a.join(", ") # outputs "9, 6, 4, 2"
-\end{lst}
-
-@!cmp@ indicates the closure parameter of the @sort@ method.
-The documentation of the @sort@ method says that @!cmp@ is used to compare two elements.
-Thus, @sort@ provides to @!cmp@ two elements and expects a Boolean result. %saying if the first element provided should be sorted before the second element provided.
-%Therefore, when invoking @sort@, the programmer gets two automatic variables (one associated to each element) and is expected to return a Boolean.
-
-Closures can also be used to perform work.
-In the following example, @file_open@ is used to open a file for reading.
-If the opening fails, the @!error@ closure is executed with the reason as argument (``file not found'' for instance).
-If the opening is successful, @!work@ is executed and the automatic variable @f@ is associated with the opened file handler.
-@file_open@ also ensures that the file is correctly closed when the @!work@ closure returns.
-
-\begin{lst}
-var fname = "input.txt"
-file_open(fname) !work(f) do
-       print f.read_line
-!error(e) do
-       print "Cannot open '{fname}': {e}"
-end
-\end{lst}
-
-Note that a method can have multiple closures.
-Syntactically, a closure is ended by the start of another closure or by the @end@ keyword that terminates the list of the closures.
-In the one-liner version, there is no @end@ but only one closure can be used.
-
-Closures can access visible variables.
-In the following example, the @iterate@ procedure asks for an @!each@ closure that is executed on each element of a @Collection@.
-In fact, the @for@ control structure is a call of the @iterate@ method.
-The following two examples are thus strictly equivalent.
-
-\begin{multicols}{2}
-\begin{lst}
-var sum = 0
-var a = [4, 2, 9]
-a.iterate !each(i) do
-       sum += i
-end
-print sum # outputs "15"
-\end{lst}
-\columnbreak
-\begin{lst}
-var sum = 0
-var a = [4, 2, 9]
-for i in a do
-       sum += i
-end
-print sum # outputs "15"
-\end{lst}
-\end{multicols}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Returning Values and Escaping}\label{closure return}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-@break@ and @continue@ are extended to closures.
-
-@continue@ exits the closure.
-If the closure expects a return value, @continue@ can also be used to return the correct value.
-As with method definition, the @do continue value@ syntax can be replaced by @= value@ as in the first @sort@ example.
-
-
-@break@ exits completely the called method.
-If the called method is a function, @break@ is also used to set the result returned by the function.
-The types returned by @break@ can be different from the return type of the function.
-The return type of the whole expression is the combination\goto{combination} of the return type of the function and the types of each @break@.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Closures in Method Declarations}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Closure parameters are declared with their signature between the prototype and the @do@ of the method.
-Closure invocations in the body of the method simply use the closure name (without the @!@) like a standard call.
-More than one closure parameter can be declared.
-Each has to be declared on a separate line.
-%At the method invocations, the closure name is used to associate each closure definition with each closure parameter.
-The order of the closure definitions does not matter.
-
-\begin{multicols}{2}
-\begin{lst}
-fun twice
-       !work
-do
-       work
-       work
-end
-twice !work do print "One"
-# outputs "One One"
-\end{lst}
-
-
-\begin{lst}
-fun foo(i: String): String
-       !f(j: String): String
-do
-       var k = f(i + "B")
-       # k will be "ABC"
-       return k + "D"
-end
-var x = foo("A") !f(y) =
-               y + "C"
-print x # outputs "ABCD"
-\end{lst}
-\columnbreak
-\begin{lst}
-fun bar(i: String)
-       !b1(j: String): String
-       !b2(k: String)
-do
-       b2(b1(i))
-end
-
-bar("A") !b1(y) do
-       continue y + "B"
-!b2(z) do
-       print z
-end
-# outputs "AB"
-\end{lst}
-\end{multicols}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Default Closures}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-A default closure can be given along with the closure parameter declaration in a method.
-If there is no default closure, then the corresponding closure argument is mandatory.
-Otherwise, if there is a default closure, the corresponding closure argument is optional.
-
-
-\begin{lst}
-fun are_all_comparable(a: Collection[Int]): Bool
-       !cmp(x, y: Int): Bool = x == y
-do
-       if a.is_empty then return true
-       var e1 = a.first
-       for e2 in a do if not cmp(e1, e2) then return false
-       return true
-end
-
-var a = [2, 2, 6, 2]
-print are_all_comparable(a) # outputs "false"
-var x = are_all_comparable(a) !cmp(i, j) = i%2 == j%2
-print x # outputs "true"
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Break Closures}\label{break closure}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Some closures, called break closures, cannot be continued.
-On the method definition, it means that the closure invocation does not return (like a @return@ or an @abort@).
-On method invocations, it means that the closure definition must not continue.
-Break closures are usually used to process error or exception handling.
-
-
-\begin{lst}
-fun open_file(fname: String)
-       !work(f: File)
-       break !error(e: String) do
-               print "Cannot open {fname}: {e}."
-               abort
-       end
-do
-       # ...
-end
-
-open_file("config.ini") !error(e) do
-       print "Cannot open file (config.ini): {e}."
-!work(f) do
-       # ...
-end
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\subsection{Full Closure Example}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-To conclude the explanation about closures, the last example shows the bracket operator\goto{operator} (@[]@) of the @Map@ interface.
-A map, like @HashMap@, is used to implement a dictionary that associates some objects (keys) to some other objects (items).
-The operator returns the item associated to key.
-The operator has a @!def@ closure that is executed when the key is not found.
-@!def@ is expected to return the item associated with the new key so it can be stored in the hashmap then returned.
-By default, @!def@ aborts.
-
-
-\begin{lst}
-var map = new HashMap[Int, String]
-map[5] = "five" # associate '5' to "five"
-var x1 = map[5] # return "five"
-var x2 = map[6] !def = "six" # associate '6' to "six" 
-                               # and return "six"
-var x3 = map[6] !def = "?" # return "six" since '6' is
-                               # a known key
-var x4 = map[7] !def do break "seven" # return "seven" 
-                               # since '7' is not a known key
-var x5 = map[7] # aborts since '7' was not associated 
-                               # with the previous statement
-\end{lst}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Conclusion}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-The specification of Nit is not yet completed.
-At least the major following features need to be implemented and documented:
-\begin{itemize}
-\item User-defined @enum@.
-\item Union and intersection types.
-\item A usable native interface to bind Nit with system libraries and other languages.
-\end{itemize}
-Moreover, the language also needs a complete and stable standard library.
-
-Some other topics also need a deeper analysis : exceptions, threads, parallelism, contracts, etc.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Index}\label{index}{\small\raggedleft
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@#@\goto{comment},
-@!@\goto{closure},
-@.@\goto{call},
-@..@\goto{Range},
-@...@\goto{vararg},
-@{}@\goto{String},
-@[]@ (array)\goto{Array},
-@[]@ (operator)\goto{operator},
-@[]@ (generic)\goto{generic},
-@"@\goto{String},
-@abstract@ (class)\goto{class},
-@abstract@ (method)\goto{abstract},
-adaptive typing\goto{adaptive typing},
-@and@\goto{Bool},
-@Array@\goto{Array},
-@as@\goto{as},
-@assert@\goto{assert},
-attribute\goto{attribute},
-@Bool@\goto{Bool},
-@break@\goto{break},
-break closure\goto{break closure},
-cast\goto{as},
-@class@\goto{class},
-closure\goto{closure},
-comment\goto{comment},
-constructor\goto{init},
-@continue@\goto{continue},
-control structure\goto{control},
-@do@\goto{do},
-@else@ (if)\goto{if},
-@else@ (abort)\goto{abort},
-@end@\goto{end},
-@enum@\goto{class},
-@extern@\goto{extern},
-@false@\goto{Bool},
-@Float@\goto{Float}
-@for@\goto{for},
-@fun@\goto{fun},
-generic class\goto{generic},
-getter\goto{attribute},
-@HashMap@\goto{HashMap},
-identifier\goto{identifier},
-@if@\goto{if},
-@import@\goto{import},
-@in@\goto{for},
-@init@\goto{init},
-inheritance\goto{superclass},
-@Int@\goto{Int},
-@interface@\goto{class},
-@intern@\goto{intern},
-@is@\goto{is},
-@isa@\goto{isa},
-@isset@\goto{isset},
-@label@\goto{label},
-@loop@\goto{loop},
-@module@\goto{module}
-@new@\goto{new},
-@not@\goto{Bool},
-@not null@\goto{null},
-@null@\goto{null},
-@nullable@\goto{null},
-@Object@\goto{Object},
-operator\goto{operator},
-@or@\goto{Bool},
-@or else@\goto{or else} 
-@private@\goto{visibility}
-@protected@\goto{visibility},
-@Range@\goto{Range},
-@redef@ (class)\goto{refine},
-@redef@ (method)\goto{redef},
-@redef@ (attribute)\goto{redef var},
-@return@\goto{return},
-@self@\goto{self},
-setter\goto{operator},
-setter (attribute)\goto{attribute},
-specialization\goto{superclass},
-@String@\goto{String},
-@super@ (class)\goto{superclass},
-@super@ (method)\goto{super},
-syntax\goto{syntax},
-@then@\goto{if},
-@true@\goto{Bool},
-type (static)\goto{static type},
-@type@\goto{type},
-@upper bound@\goto{upper bound},
-@var@ (attribute)\goto{attribute},
-@var@ (variable)\goto{var},
-virtual type\goto{type},
-visibility\goto{visibility},
-@while@\goto{while},
-@writable@\goto{writable},
-}
-
diff --git a/doc/nitreference/nitreference.tex b/doc/nitreference/nitreference.tex
deleted file mode 100644 (file)
index 551d2d1..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-% This file is part of Nit ( http://www.nitlanguage.org ).
-%
-% Copyright 2011 Jean Privat <jean@pryen.org>
-%
-% Licensed under the Apache License, Version 2.0 (the "License");
-% you may not use this file except in compliance with the License.
-% You may obtain a copy of the License at
-%
-%     http://www.apache.org/licenses/LICENSE-2.0
-%
-% Unless required by applicable law or agreed to in writing, software
-% distributed under the License is distributed on an "AS IS" BASIS,
-% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-% See the License for the specific language governing permissions and
-% limitations under the License.
-\documentclass[10pt]{article}
-
-\usepackage[T1]{fontenc}
-\usepackage{nitlanguage}
-\usepackage{multicol}
-\usepackage{savetrees}
-\usepackage{listings}
-\usepackage{microtype}
-\usepackage{xcolor}
-\usepackage{comment}
-\usepackage{../nit_version}
-
-\newcommand\thedoctitle{A Concise Reference of the Nit Language}
-\title{\thedoctitle}
-\author{Jean Privat}
-\date{\today}
-
-\usepackage[bookmarks=false,pdftitle={\thedoctitle}]{hyperref}
-\pdfcompresslevel=9 %best compression level for text and image
-
-%\setcounter{collectmore}{90} % Force better column breaks
-
-\lstMakeShortInline[basicstyle=\small\ttfamily\color{blue!30!black}]{@}
-
-\hypersetup{colorlinks=true}
-\newcommand\goto[1]{\hyperref[#1]{{\color{red}\scriptsize[\ref*{#1}]}}}
-\newcommand\future[1]{}
-
-\geometry{margin=0.35in} % short margins
-% footer
-\usepackage{fancyhdr}
-\pagestyle{fancy}
-\lhead{}
-\chead{}
-\rhead{}
-\lfoot{\small\it\today}
-\cfoot{\small\it\thedoctitle~---~\nitversion}
-\rfoot{\small\it\thepage}
-\renewcommand{\headrulewidth}{0pt}
-\renewcommand{\footrulewidth}{0pt}
-\setlength\footskip{15pt}
-
-\begin{document}
-\setlength\columnsep{8pt} % space around big columns
-\begin{multicols}{2}
-\setlength\columnsep{4pt} % space around smalls columns (for examples)
-\input{nitreference-main.tex}
-\end{multicols}
-\end{document}