From 5272213da4b0701890d8a42fb292962704f0b99d Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 11 Oct 2014 01:30:17 +0200 Subject: [PATCH] documentation updates --- compiler/nversion.nim | 4 ++-- doc/manual/lexing.txt | 33 +++++++++++++++++++++------ todo.txt | 2 +- tools/restorecc.nim | 16 +++++++++++++ web/index.txt | 52 +++++++++++++++++++++---------------------- web/news.txt | 8 +++++-- web/question.txt | 43 ++++++++++++++++++----------------- 7 files changed, 99 insertions(+), 59 deletions(-) create mode 100644 tools/restorecc.nim diff --git a/compiler/nversion.nim b/compiler/nversion.nim index 968feb0816..c29880fe25 100644 --- a/compiler/nversion.nim +++ b/compiler/nversion.nim @@ -13,8 +13,8 @@ const MaxSetElements* = 1 shl 16 # (2^16) to support unicode character sets? VersionMajor* = 0 - VersionMinor* = 9 - VersionPatch* = 6 + VersionMinor* = 10 + VersionPatch* = 0 VersionAsString* = $VersionMajor & "." & $VersionMinor & "." & $VersionPatch RodFileVersion* = "1215" # modify this if the rod-format changes! diff --git a/doc/manual/lexing.txt b/doc/manual/lexing.txt index c3894b13d7..4de7936a32 100644 --- a/doc/manual/lexing.txt +++ b/doc/manual/lexing.txt @@ -93,14 +93,33 @@ The following keywords are reserved and cannot be used as identifiers: Some keywords are unused; they are reserved for future developments of the language. -Nim is a `style-insensitive`:idx: language. This means that it is not -case-sensitive and even underscores are ignored: -**type** is a reserved word, and so is **TYPE** or **T_Y_P_E**. The idea behind -this is that this allows programmers to use their own preferred spelling style -and libraries written by different programmers cannot use incompatible -conventions. A Nim-aware editor or IDE can show the identifiers as + +Identifier equality +------------------- + +Two identifiers are considered equal if the following algorithm returns true: + +.. code-block:: nim + proc sameIdentifier(a, b: string): bool = + a[0] == b[0] and a.replace("_", "").toLower == b.replace("_", "").toLower + +That means only the first letters are compared in a case sensitive manner. Other +letters are compared case insensitively and underscores are ignored. + +This rather strange way to do identifier comparisons is called +`partial case insensitivity`:idx: and has some advantages over the conventional +case sensitivity: + +It allows programmers to mostly use their own preferred +spelling style and libraries written by different programmers cannot use +incompatible conventions. A Nim-aware editor or IDE can show the identifiers as preferred. Another advantage is that it frees the programmer from remembering -the exact spelling of an identifier. +the exact spelling of an identifier. The exception with respect to the first +letter allows common code like ``var foo: Foo`` to be parsed unambiguously. + +Historically, Nim was a `style-insensitive`:idx: language. This means that it +was not case-sensitive and underscores were ignored and there was no distinction +between ``foo`` and ``Foo``. String literals diff --git a/todo.txt b/todo.txt index e24175e8b2..3e511dc491 100644 --- a/todo.txt +++ b/todo.txt @@ -1,7 +1,6 @@ version 0.10 ============ -- fix the bug that keeps 'defer' template from working - Test nimfix on various babel packages @@ -37,6 +36,7 @@ Misc Bugs ==== +- fix the bug that keeps 'defer' template from working - VM: Pegs do not work at compile-time - VM: ptr/ref T cannot work in general - scopes are still broken for generic instantiation! diff --git a/tools/restorecc.nim b/tools/restorecc.nim new file mode 100644 index 0000000000..f5d8f0bb37 --- /dev/null +++ b/tools/restorecc.nim @@ -0,0 +1,16 @@ + +import os, strutils + +proc main(dir: string, wanted: string) = + for kind, path in walkDir(dir): + case kind + of pcFile: + let name = extractFilename(path) + if name == wanted: + let newLoc = path.replace("mingw_backup", "mingw") + echo "creating ", newLoc + copyFile(path, newLoc) + of pcDir: main(path, wanted) + else: discard + +main("dist/mingw_backup", paramStr(1)) diff --git a/web/index.txt b/web/index.txt index 947ebb7060..04c9536282 100644 --- a/web/index.txt +++ b/web/index.txt @@ -2,13 +2,13 @@ Home ==== -Welcome to Nimrod ------------------ +Welcome to Nim +-------------- -**Nimrod** is a statically typed, imperative programming language that tries to -give the programmer ultimate power without compromises on runtime efficiency. -This means it focuses on compile-time mechanisms in all their -various forms. +**Nim** (formerly known as "Nimrod") is a statically typed, imperative +programming language that tries to give the programmer ultimate power without +compromises on runtime efficiency. This means it focuses on compile-time +mechanisms in all their various forms. Beneath a nice infix/indentation based syntax with a powerful (AST based, hygienic) macro system lies a semantic model that supports @@ -18,10 +18,10 @@ shared memory heap is also provided for the increased efficiency that results from that model. -Nimrod looks like this: -======================= +Nim looks like this: +==================== -.. code-block:: nimrod +.. code-block:: nim # compute average line length var count = 0 var sum = 0 @@ -34,11 +34,11 @@ Nimrod looks like this: if count > 0: sum / count else: 0 -Nimrod is efficient -=================== +Nim is efficient +================ * Native code generation (currently via compilation to C), not dependent on a - virtual machine: **Nimrod produces small executables without dependencies + virtual machine: **Nim produces small executables without dependencies for easy redistribution.** * A fast **non-tracing** garbage collector that supports soft real-time systems (like games). @@ -55,11 +55,11 @@ Nimrod is efficient the stack. -Nimrod is expressive -==================== +Nim is expressive +================= -* **The Nimrod compiler and all of the standard library are implemented in - Nimrod.** +* **The Nim compiler and all of the standard library are implemented in + Nim.** * Built-in high level datatypes: strings, sets, sequences, etc. * Modern type system with local type inference, tuples, variants, generics, etc. @@ -69,31 +69,31 @@ Nimrod is expressive * Macros can modify the abstract syntax tree at compile time. -Nimrod is elegant -================= +Nim is elegant +============== -* Macros can use the imperative paradigm to construct parse trees. Nimrod +* Macros can use the imperative paradigm to construct parse trees. Nim does not require a different coding style for meta programming. -* Macros cannot change Nimrod's syntax because there is no need for it. - Nimrod's syntax is flexible enough. +* Macros cannot change Nim's syntax because there is no need for it. + Nim's syntax is flexible enough. * Statements are grouped by indentation but can span multiple lines. Indentation must not contain tabulators so the compiler always sees the code the same way as you do. -Nimrod plays nice with others -============================= +Nim plays nice with others +========================== -* The Nimrod Compiler runs on Windows, Linux, BSD and Mac OS X. +* The Nim Compiler runs on Windows, Linux, BSD and Mac OS X. Porting to other platforms is easy. -* **The Nimrod Compiler can also generate C++ or Objective C for easier +* **The Nim Compiler can also generate C++ or Objective C for easier interfacing.** * There are lots of bindings: for example, bindings to GTK2, the Windows API, the POSIX API, OpenGL, SDL, Cairo, Python, Lua, TCL, X11, libzip, PCRE, libcurl, mySQL and SQLite are included in the standard distribution or can easily be obtained via the `Babel package manager `_. -* A C to Nimrod conversion utility: New bindings to C libraries are easily +* A C to Nim conversion utility: New bindings to C libraries are easily generated by ``c2nim``. diff --git a/web/news.txt b/web/news.txt index ceb23a6dda..8a28292e68 100644 --- a/web/news.txt +++ b/web/news.txt @@ -3,8 +3,8 @@ News ==== .. - 2014-06-29 Version 0.9.6 released - ================================= + 2014-10-11 Version 0.10.0 released + ================================== Changes affecting backwards compatibility ----------------------------------------- @@ -47,6 +47,10 @@ News found under the `nim-code `_ organisation. - Removed the deprecated ``web`` module, the ``httpclient`` module should be used instead. + - Large parts of the stdlib got rid of the T/P type prefixes. Instead most + types now simply start with an uppercased letter. The + so called "partial case sensitivity" is now active allowing code + like ``var foo: Foo``. - String case (or any non-ordinal case) statements without 'else' are deprecated. - Recursive tuple types are not allowed anymore. Use ``object`` instead. diff --git a/web/question.txt b/web/question.txt index e6f4d40a54..52809ff90a 100644 --- a/web/question.txt +++ b/web/question.txt @@ -6,11 +6,12 @@ General ======= -What is Nimrod? ---------------- +What is Nim? +------------ -Nimrod is a statically typed, imperative programming language that tries to -give the programmer ultimate power without compromises on runtime efficiency. +Nim (formerly known as "Nimrod") is a statically typed, imperative programming +language that tries to give the programmer ultimate power without compromises +on runtime efficiency. This means it focuses on compile-time mechanisms in all their various forms. Beneath a nice infix/indentation based syntax with a powerful (AST based, hygienic) macro system lies a semantic model that supports @@ -23,7 +24,7 @@ from that model. Why yet another programming language? ------------------------------------- -Nimrod is one of the very few *programmable* statically typed languages, and +Nim is one of the very few *programmable* statically typed languages, and one of the even fewer that produces native binaries that require no runtime or interpreter. @@ -36,29 +37,29 @@ C++, Python, Lisp, Oberon. -What is Nimrod's take on concurrency? -------------------------------------- +What is Nim's take on concurrency? +---------------------------------- -Nimrod primarily focusses on thread local (and garbage collected) heaps and -asynchronous message passing between threads. Each thread has its own GC, so no +Nim primarily focusses on thread local (and garbage collected) heaps and +message passing between threads. Each thread has its own GC, so no "stop the world" mechanism is necessary. An unsafe shared memory heap is also -provided. +provided. Future versions will additionally include a GC "per thread group" -and Nimrod's type system will be enhanced to accurately model this shared +and Nim's type system will be enhanced to accurately model this shared memory heap. -How is Nimrod licensed? ------------------------ +How is Nim licensed? +-------------------- -The Nimrod compiler and the library are MIT licensed. +The Nim compiler and the library are MIT licensed. This means that you can use any license for your own programs developed with -Nimrod. +Nim. -How stable is Nimrod? ---------------------- +How stable is Nim? +------------------ The compiler is in development and some important features are still missing. However, the compiler is quite stable already: It is able to compile itself @@ -66,11 +67,11 @@ and a substantial body of other code. Until version 1.0.0 is released, minor incompatibilities with older versions of the compiler will be introduced. -How fast is Nimrod? -------------------- +How fast is Nim? +---------------- Benchmarks show it to be comparable to C. Some language features (methods, closures, message passing) are not yet as optimized as they could and will be. -The only overhead Nimrod has over C is the GC which has been tuned +The only overhead Nim has over C is the GC which has been tuned for years but still needs some work. @@ -84,7 +85,7 @@ but would require much work. What about editor support? -------------------------- -- Nimrod IDE: https://github.com/nimrod-code/Aporia +- Nim IDE: https://github.com/nimrod-code/Aporia - Emacs: https://github.com/Tass/nimrod-mode - Vim: https://github.com/zah/nimrod.vim/ - Scite: Included