e014_version_0_11_0.rst 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. Version 0.11.0 released
  2. =======================
  3. .. container:: metadata
  4. Posted by Dominik Picheta on 30/04/2015
  5. With this release we are one step closer to reaching version 1.0 and by
  6. extension the persistence of the Nim specification. As mentioned in the
  7. previous release notes, starting with version 1.0, we will not be introducing
  8. any more breaking changes to Nim.
  9. The *language* itself is very close to 1.0, the primary area that requires
  10. more work is the standard library.
  11. Take a look at the `download <download.html>`_ page for binaries (Windows-only)
  12. and 0.11.0 snapshots of the source code. The Windows installer now also
  13. includes `Aporia <https://github.com/nim-lang/aporia>`_,
  14. `Nimble <https://github.com/nim-lang/nimble>`_ and other useful tools to get
  15. you started with Nim.
  16. What's left to be done
  17. ~~~~~~~~~~~~~~~~~~~~~~
  18. The 1.0 release is expected by the end of this year. Rumors say it will be in
  19. summer 2015. What's left:
  20. * Bug fixes, bug fixes, bug fixes, in particular:
  21. - The remaining bugs of the lambda lifting pass that is responsible to enable
  22. closures and closure iterators need to be fixed.
  23. - ``concept`` needs to be refined, a nice name for the feature is not enough.
  24. - Destructors need to be refined.
  25. - ``static[T]`` needs to be fixed.
  26. - Finish the implementation of the 'parallel' statement.
  27. * ``immediate`` templates and macros will be deprecated as these will soon be
  28. completely unnecessary, instead the ``typed`` or ``untyped`` metatypes can
  29. be used.
  30. * More of the standard library should be moved to Nimble packages and what's
  31. left should use the features we have for concurrency and parallelism.
  32. Changes affecting backwards compatibility
  33. -----------------------------------------
  34. - Parameter names are finally properly ``gensym``'ed. This can break
  35. templates though that used to rely on the fact that they are not.
  36. (Bug #1915.) This means this doesn't compile anymore:
  37. .. code-block:: nim
  38. template doIt(body: stmt) {.immediate.} =
  39. # this used to inject the 'str' parameter:
  40. proc res(str: string) =
  41. body
  42. doIt:
  43. echo str # Error: undeclared identifier: 'str'
  44. ..
  45. This used to inject the ``str`` parameter into the scope of the body.
  46. Declare the ``doIt`` template as ``immediate, dirty`` to get the old
  47. behaviour.
  48. - Tuple field names are not ignored anymore, this caused too many problems
  49. in practice so now the behaviour is as it was for version 0.9.6: If field
  50. names exist for the tuple type, they are checked.
  51. - ``logging.level`` and ``logging.handlers`` are no longer exported.
  52. ``addHandler``, ``getHandlers``, ``setLogFilter`` and ``getLogFilter``
  53. should be used instead.
  54. - ``nim idetools`` has been replaced by a separate
  55. tool `nimsuggest <0.11.0/nimsuggest.html>`_.
  56. - *arrow like* operators are not right associative anymore and are required
  57. to end with either ``->``, ``~>`` or
  58. ``=>``, not just ``>``. Examples of operators still considered arrow like:
  59. ``->``, ``==>``, ``+=>``. On the other hand, the following operators are now
  60. considered regular operators again: ``|>``, ``-+>``, etc.
  61. - Typeless parameters are now only allowed in templates and macros. The old
  62. way turned out to be too error-prone.
  63. - The 'addr' and 'type' operators are now parsed as unary function
  64. application. This means ``type(x).name`` is now parsed as ``(type(x)).name``
  65. and not as ``type((x).name)``. Note that this also affects the AST
  66. structure; for immediate macro parameters ``nkCall('addr', 'x')`` is
  67. produced instead of ``nkAddr('x')``.
  68. - ``concept`` is now a keyword and is used instead of ``generic``.
  69. - The ``inc``, ``dec``, ``+=``, ``-=`` builtins now produce OverflowError
  70. exceptions. This means code like the following:
  71. .. code-block:: nim
  72. var x = low(T)
  73. while x <= high(T):
  74. echo x
  75. inc x
  76. Needs to be replaced by something like this:
  77. .. code-block:: nim
  78. var x = low(T).int
  79. while x <= high(T).int:
  80. echo x.T
  81. inc x
  82. - **Negative indexing for slicing does not work anymore!** Instead
  83. of ``a[0.. -1]`` you can
  84. use ``a[0.. ^1]``. This also works with accessing a single
  85. element ``a[^1]``. Note that we cannot detect this reliably as it is
  86. determined at **runtime** whether negative indexing is used!
  87. ``a[0.. -1]`` now produces the empty string/sequence.
  88. - The compiler now warns about code like ``foo +=1`` which uses inconsistent
  89. spacing around binary operators. Later versions of the language will parse
  90. these as unary operators instead so that ``echo $foo`` finally can do what
  91. people expect it to do.
  92. - ``system.untyped`` and ``system.typed`` have been introduced as aliases
  93. for ``expr`` and ``stmt``. The new names capture the semantics much better
  94. and most likely ``expr`` and ``stmt`` will be deprecated in favor of the
  95. new names.
  96. - The ``split`` method in module ``re`` has changed. It now handles the case
  97. of matches having a length of 0, and empty strings being yielded from the
  98. iterator. A notable change might be that a pattern being matched at the
  99. beginning and end of a string, will result in an empty string being produced
  100. at the start and the end of the iterator.
  101. - The compiler and nimsuggest now count columns starting with 1, not 0 for
  102. consistency with the rest of the world.
  103. Language Additions
  104. ------------------
  105. - For empty ``case object`` branches ``discard`` can finally be used instead
  106. of ``nil``.
  107. - Automatic dereferencing is now done for the first argument of a routine
  108. call if overloading resolution produces no match otherwise. This feature
  109. has to be enabled with
  110. the `experimental <0.11.0/manual.html#pragmas-experimental-pragma>`_ pragma.
  111. - Objects that do not use inheritance nor ``case`` can be put into ``const``
  112. sections. This means that finally this is possible and produces rather
  113. nice code:
  114. .. code-block:: nim
  115. import tables
  116. const
  117. foo = {"ah": "finally", "this": "is", "possible.": "nice!"}.toTable()
  118. - Ordinary parameters can follow after a varargs parameter. This means the
  119. following is finally accepted by the compiler:
  120. .. code-block:: nim
  121. template takesBlock(a, b: int, x: varargs[expr]; blck: stmt) =
  122. blck
  123. echo a, b
  124. takesBlock 1, 2, "some", 0.90, "random stuff":
  125. echo "yay"
  126. - Overloading by 'var T' is now finally possible:
  127. .. code-block:: nim
  128. proc varOrConst(x: var int) = echo "var"
  129. proc varOrConst(x: int) = echo "const"
  130. var x: int
  131. varOrConst(x) # "var"
  132. varOrConst(45) # "const"
  133. - Array and seq indexing can now use the builtin ``^`` operator to access
  134. things from backwards: ``a[^1]`` is like Python's ``a[-1]``.
  135. - A first version of the specification and implementation of the overloading
  136. of the assignment operator has arrived!
  137. - ``system.len`` for strings and sequences now returns 0 for nil.
  138. - A single underscore can now be used to discard values when unpacking tuples:
  139. .. code-block:: nim
  140. let (path, _, _) = os.splitFile("path/file.ext")
  141. - ``marshal.$$`` and ``marshal.to`` can be executed at compile-time.
  142. - Interoperability with C++ improved tremendously; C++'s templates and
  143. operators can be wrapped directly. See
  144. `this <0.11.0/nimc.html#additional-features-importcpp-pragma>`_
  145. for more information.
  146. - ``macros.getType`` can be used to query an AST's type at compile-time. This
  147. enables more powerful macros, for instance *currying* can now be done with
  148. a macro.
  149. Library additions
  150. -----------------
  151. - ``reversed`` proc added to the ``unicode`` module.
  152. - Added multipart param to httpclient's ``post`` and ``postContent`` together
  153. with a ``newMultipartData`` proc.
  154. - Added `%*` operator for JSON.
  155. - The compiler is now available as Nimble package for c2nim.
  156. - Added ``..^`` and ``..<`` templates to system so that the rather annoying
  157. space between ``.. <`` and ``.. ^`` is not necessary anymore.
  158. - Added ``system.xlen`` for strings and sequences to get back the old ``len``
  159. operation that doesn't check for ``nil`` for efficiency.
  160. - Added sexp.nim to parse and generate sexp.
  161. Bugfixes
  162. --------
  163. - Fixed internal compiler error when using ``char()`` in an echo call
  164. (`#1788 <https://github.com/Araq/Nim/issues/1788>`_).
  165. - Fixed Windows cross-compilation on Linux.
  166. - Overload resolution now works for types distinguished only by a
  167. ``static[int]`` param
  168. (`#1056 <https://github.com/Araq/Nim/issues/1056>`_).
  169. - Other fixes relating to generic types and static params.
  170. - Fixed some compiler crashes with unnamed tuples
  171. (`#1774 <https://github.com/Araq/Nim/issues/1774>`_).
  172. - Fixed ``channels.tryRecv`` blocking
  173. (`#1816 <https://github.com/Araq/Nim/issues/1816>`_).
  174. - Fixed generic instantiation errors with ``typedesc``
  175. (`#419 <https://github.com/Araq/Nim/issues/419>`_).
  176. - Fixed generic regression where the compiler no longer detected constant
  177. expressions properly (`#544 <https://github.com/Araq/Nim/issues/544>`_).
  178. - Fixed internal error with generic proc using ``static[T]`` in a specific
  179. way (`#1049 <https://github.com/Araq/Nim/issues/1049>`_).
  180. - More fixes relating to generics (`#1820 <https://github.com/Araq/Nim/issues/1820>`_,
  181. `#1050 <https://github.com/Araq/Nim/issues/1050>`_,
  182. `#1859 <https://github.com/Araq/Nim/issues/1859>`_,
  183. `#1858 <https://github.com/Araq/Nim/issues/1858>`_).
  184. - Fixed httpclient to properly encode queries.
  185. - Many fixes to the ``uri`` module.
  186. - Async sockets are now closed on error.
  187. - Fixes to httpclient's handling of multipart data.
  188. - Fixed GC segfaults with asynchronous sockets
  189. (`#1796 <https://github.com/Araq/Nim/issues/1796>`_).
  190. - Added more versions to openssl's DLL version list
  191. (`076f993 <https://github.com/Araq/Nim/commit/076f993>`_).
  192. - Fixed shallow copy in iterators being broken
  193. (`#1803 <https://github.com/Araq/Nim/issues/1803>`_).
  194. - ``nil`` can now be inserted into tables with the ``db_sqlite`` module
  195. (`#1866 <https://github.com/Araq/Nim/issues/1866>`_).
  196. - Fixed "Incorrect assembler generated"
  197. (`#1907 <https://github.com/Araq/Nim/issues/1907>`_)
  198. - Fixed "Expression templates that define macros are unusable in some contexts"
  199. (`#1903 <https://github.com/Araq/Nim/issues/1903>`_)
  200. - Fixed "a second level generic subclass causes the compiler to crash"
  201. (`#1919 <https://github.com/Araq/Nim/issues/1919>`_)
  202. - Fixed "nim 0.10.2 generates invalid AsyncHttpClient C code for MSVC "
  203. (`#1901 <https://github.com/Araq/Nim/issues/1901>`_)
  204. - Fixed "1 shl n produces wrong C code"
  205. (`#1928 <https://github.com/Araq/Nim/issues/1928>`_)
  206. - Fixed "Internal error on tuple yield"
  207. (`#1838 <https://github.com/Araq/Nim/issues/1838>`_)
  208. - Fixed "ICE with template"
  209. (`#1915 <https://github.com/Araq/Nim/issues/1915>`_)
  210. - Fixed "include the tool directory in the installer as it is required by koch"
  211. (`#1947 <https://github.com/Araq/Nim/issues/1947>`_)
  212. - Fixed "Can't compile if file location contains spaces on Windows"
  213. (`#1955 <https://github.com/Araq/Nim/issues/1955>`_)
  214. - Fixed "List comprehension macro only supports infix checks as guards"
  215. (`#1920 <https://github.com/Araq/Nim/issues/1920>`_)
  216. - Fixed "wrong field names of compatible tuples in generic types"
  217. (`#1910 <https://github.com/Araq/Nim/issues/1910>`_)
  218. - Fixed "Macros within templates no longer work as expected"
  219. (`#1944 <https://github.com/Araq/Nim/issues/1944>`_)
  220. - Fixed "Compiling for Standalone AVR broken in 0.10.2"
  221. (`#1964 <https://github.com/Araq/Nim/issues/1964>`_)
  222. - Fixed "Compiling for Standalone AVR broken in 0.10.2"
  223. (`#1964 <https://github.com/Araq/Nim/issues/1964>`_)
  224. - Fixed "Code generation for mitems with tuple elements"
  225. (`#1833 <https://github.com/Araq/Nim/issues/1833>`_)
  226. - Fixed "httpclient.HttpMethod should not be an enum"
  227. (`#1962 <https://github.com/Araq/Nim/issues/1962>`_)
  228. - Fixed "terminal / eraseScreen() throws an OverflowError"
  229. (`#1906 <https://github.com/Araq/Nim/issues/1906>`_)
  230. - Fixed "setControlCHook(nil) disables registered quit procs"
  231. (`#1546 <https://github.com/Araq/Nim/issues/1546>`_)
  232. - Fixed "Unexpected idetools behaviour"
  233. (`#325 <https://github.com/Araq/Nim/issues/325>`_)
  234. - Fixed "Unused lifted lambda does not compile"
  235. (`#1642 <https://github.com/Araq/Nim/issues/1642>`_)
  236. - Fixed "'low' and 'high' don't work with cstring asguments"
  237. (`#2030 <https://github.com/Araq/Nim/issues/2030>`_)
  238. - Fixed "Converting to int does not round in JS backend"
  239. (`#1959 <https://github.com/Araq/Nim/issues/1959>`_)
  240. - Fixed "Internal error genRecordField 2 when adding region to pointer."
  241. (`#2039 <https://github.com/Araq/Nim/issues/2039>`_)
  242. - Fixed "Macros fail to compile when compiled with --os:standalone"
  243. (`#2041 <https://github.com/Araq/Nim/issues/2041>`_)
  244. - Fixed "Reading from {.compileTime.} variables can cause code generation to fail"
  245. (`#2022 <https://github.com/Araq/Nim/issues/2022>`_)
  246. - Fixed "Passing overloaded symbols to templates fails inside generic procedures"
  247. (`#1988 <https://github.com/Araq/Nim/issues/1988>`_)
  248. - Fixed "Compiling iterator with object assignment in release mode causes "var not init""
  249. (`#2023 <https://github.com/Araq/Nim/issues/2023>`_)
  250. - Fixed "calling a large number of macros doing some computation fails"
  251. (`#1989 <https://github.com/Araq/Nim/issues/1989>`_)
  252. - Fixed "Can't get Koch to install nim under Windows"
  253. (`#2061 <https://github.com/Araq/Nim/issues/2061>`_)
  254. - Fixed "Template with two stmt parameters segfaults compiler"
  255. (`#2057 <https://github.com/Araq/Nim/issues/2057>`_)
  256. - Fixed "`noSideEffect` not affected by `echo`"
  257. (`#2011 <https://github.com/Araq/Nim/issues/2011>`_)
  258. - Fixed "Compiling with the cpp backend ignores --passc"
  259. (`#1601 <https://github.com/Araq/Nim/issues/1601>`_)
  260. - Fixed "Put untyped procedure parameters behind the experimental pragma"
  261. (`#1956 <https://github.com/Araq/Nim/issues/1956>`_)
  262. - Fixed "generic regression"
  263. (`#2073 <https://github.com/Araq/Nim/issues/2073>`_)
  264. - Fixed "generic regression"
  265. (`#2073 <https://github.com/Araq/Nim/issues/2073>`_)
  266. - Fixed "Regression in template lookup with generics"
  267. (`#2004 <https://github.com/Araq/Nim/issues/2004>`_)
  268. - Fixed "GC's growObj is wrong for edge cases"
  269. (`#2070 <https://github.com/Araq/Nim/issues/2070>`_)
  270. - Fixed "Compiler internal error when creating an array out of a typeclass"
  271. (`#1131 <https://github.com/Araq/Nim/issues/1131>`_)
  272. - Fixed "GC's growObj is wrong for edge cases"
  273. (`#2070 <https://github.com/Araq/Nim/issues/2070>`_)
  274. - Fixed "Invalid Objective-C code generated when calling class method"
  275. (`#2068 <https://github.com/Araq/Nim/issues/2068>`_)
  276. - Fixed "walkDirRec Error"
  277. (`#2116 <https://github.com/Araq/Nim/issues/2116>`_)
  278. - Fixed "Typo in code causes compiler SIGSEGV in evalAtCompileTime"
  279. (`#2113 <https://github.com/Araq/Nim/issues/2113>`_)
  280. - Fixed "Regression on exportc"
  281. (`#2118 <https://github.com/Araq/Nim/issues/2118>`_)
  282. - Fixed "Error message"
  283. (`#2102 <https://github.com/Araq/Nim/issues/2102>`_)
  284. - Fixed "hint[path] = off not working in nim.cfg"
  285. (`#2103 <https://github.com/Araq/Nim/issues/2103>`_)
  286. - Fixed "compiler crashes when getting a tuple from a sequence of generic tuples"
  287. (`#2121 <https://github.com/Araq/Nim/issues/2121>`_)
  288. - Fixed "nim check hangs with when"
  289. (`#2123 <https://github.com/Araq/Nim/issues/2123>`_)
  290. - Fixed "static[T] param in nested type resolve/caching issue"
  291. (`#2125 <https://github.com/Araq/Nim/issues/2125>`_)
  292. - Fixed "repr should display ``\0``"
  293. (`#2124 <https://github.com/Araq/Nim/issues/2124>`_)
  294. - Fixed "'nim check' never ends in case of recursive dependency "
  295. (`#2051 <https://github.com/Araq/Nim/issues/2051>`_)
  296. - Fixed "From macros: Error: unhandled exception: sons is not accessible"
  297. (`#2167 <https://github.com/Araq/Nim/issues/2167>`_)
  298. - Fixed "`fieldPairs` doesn't work inside templates"
  299. (`#1902 <https://github.com/Araq/Nim/issues/1902>`_)
  300. - Fixed "fields iterator misbehavior on break statement"
  301. (`#2134 <https://github.com/Araq/Nim/issues/2134>`_)
  302. - Fixed "Fix for compiler not building anymore since #c3244ef1ff"
  303. (`#2193 <https://github.com/Araq/Nim/issues/2193>`_)
  304. - Fixed "JSON parser fails in cpp output mode"
  305. (`#2199 <https://github.com/Araq/Nim/issues/2199>`_)
  306. - Fixed "macros.getType mishandles void return"
  307. (`#2211 <https://github.com/Araq/Nim/issues/2211>`_)
  308. - Fixed "Regression involving templates instantiated within generics"
  309. (`#2215 <https://github.com/Araq/Nim/issues/2215>`_)
  310. - Fixed ""Error: invalid type" for 'not nil' on generic type."
  311. (`#2216 <https://github.com/Araq/Nim/issues/2216>`_)
  312. - Fixed "--threads:on breaks async"
  313. (`#2074 <https://github.com/Araq/Nim/issues/2074>`_)
  314. - Fixed "Type mismatch not always caught, can generate bad code for C backend."
  315. (`#2169 <https://github.com/Araq/Nim/issues/2169>`_)
  316. - Fixed "Failed C compilation when storing proc to own type in object"
  317. (`#2233 <https://github.com/Araq/Nim/issues/2233>`_)
  318. - Fixed "Unknown line/column number in constant declaration type conversion error"
  319. (`#2252 <https://github.com/Araq/Nim/issues/2252>`_)
  320. - Fixed "Adding {.compile.} fails if nimcache already exists."
  321. (`#2247 <https://github.com/Araq/Nim/issues/2247>`_)
  322. - Fixed "Two different type names generated for a single type (C backend)"
  323. (`#2250 <https://github.com/Araq/Nim/issues/2250>`_)
  324. - Fixed "Ambigous call when it should not be"
  325. (`#2229 <https://github.com/Araq/Nim/issues/2229>`_)
  326. - Fixed "Make sure we can load root urls"
  327. (`#2227 <https://github.com/Araq/Nim/issues/2227>`_)
  328. - Fixed "Failure to slice a string with an int subrange type"
  329. (`#794 <https://github.com/Araq/Nim/issues/794>`_)
  330. - Fixed "documentation error"
  331. (`#2205 <https://github.com/Araq/Nim/issues/2205>`_)
  332. - Fixed "Code growth when using `const`"
  333. (`#1940 <https://github.com/Araq/Nim/issues/1940>`_)
  334. - Fixed "Instances of generic types confuse overload resolution"
  335. (`#2220 <https://github.com/Araq/Nim/issues/2220>`_)
  336. - Fixed "Compiler error when initializing sdl2's EventType"
  337. (`#2316 <https://github.com/Araq/Nim/issues/2316>`_)
  338. - Fixed "Parallel disjoint checking can't handle `<`, `items`, or arrays"
  339. (`#2287 <https://github.com/Araq/Nim/issues/2287>`_)
  340. - Fixed "Strings aren't copied in parallel loop"
  341. (`#2286 <https://github.com/Araq/Nim/issues/2286>`_)
  342. - Fixed "JavaScript compiler crash with tables"
  343. (`#2298 <https://github.com/Araq/Nim/issues/2298>`_)
  344. - Fixed "Range checker too restrictive"
  345. (`#1845 <https://github.com/Araq/Nim/issues/1845>`_)
  346. - Fixed "Failure to slice a string with an int subrange type"
  347. (`#794 <https://github.com/Araq/Nim/issues/794>`_)
  348. - Fixed "Remind user when compiling in debug mode"
  349. (`#1868 <https://github.com/Araq/Nim/issues/1868>`_)
  350. - Fixed "Compiler user guide has jumbled options/commands."
  351. (`#1819 <https://github.com/Araq/Nim/issues/1819>`_)
  352. - Fixed "using `method`: 1 in a objects constructor fails when compiling"
  353. (`#1791 <https://github.com/Araq/Nim/issues/1791>`_)