e031_version_0_16_2.rst 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. Version 0.17.0 released
  2. =======================
  3. This release fixes the most important regressions introduced in 0.16.0. In
  4. particular memory manager and channel bugs have been fixed. The NSIS based
  5. installer is not provided anymore as the Nim website moved to ``https`` and
  6. this causes NSIS downloads to fail.
  7. Changelog
  8. ~~~~~~~~~
  9. Changes affecting backwards compatibility
  10. -----------------------------------------
  11. - There are now two different HTTP response types, ``Response`` and
  12. ``AsyncResponse``. ``AsyncResponse``'s ``body`` accessor returns a
  13. ``Future[string]``!
  14. - ``httpclient.request`` now respects ``maxRedirects`` option. Previously
  15. redirects were handled only by ``get`` and ``post`` procs.
  16. - The IO routines now raise ``EOFError`` for the "end of file" condition.
  17. ``EOFError`` is a subtype of ``IOError`` and so it's easier to distinguish
  18. between "error during read" and "error due to EOF".
  19. - A hash procedure has been added for ``cstring`` type in ``hashes`` module.
  20. Previously, hash of a ``cstring`` would be calculated as a hash of the
  21. pointer. Now the hash is calculated from the contents of the string, assuming
  22. ``cstring`` is a null-terminated string. Equal ``string`` and ``cstring``
  23. values produce an equal hash value.
  24. - Macros accepting `varargs` arguments will now receive a node having the
  25. `nkArgList` node kind. Previous code expecting the node kind to be `nkBracket`
  26. may have to be updated.
  27. - ``memfiles.open`` now closes file handleds/fds by default. Passing
  28. ``allowRemap=true`` to ``memfiles.open`` recovers the old behavior. The old
  29. behavior is only needed to call ``mapMem`` on the resulting ``MemFile``.
  30. - ``posix.nim``: For better C++ interop the field
  31. ``sa_sigaction*: proc (x: cint, y: var SigInfo, z: pointer) {.noconv.}`` was
  32. changed
  33. to ``sa_sigaction*: proc (x: cint, y: ptr SigInfo, z: pointer) {.noconv.}``.
  34. - The compiler doesn't infer effects for ``.base`` methods anymore. This means
  35. you need to annotate them with ``.gcsafe`` or similar to clearly declare
  36. upfront every implementation needs to fullfill these contracts.
  37. - ``system.getAst templateCall(x, y)`` now typechecks the ``templateCall``
  38. properly. You need to patch your code accordingly.
  39. - ``macros.getType`` and ``macros.getTypeImpl`` for an enum will now return an
  40. AST that is the same as what is used to define an enum. Previously the AST
  41. returned had a repeated ``EnumTy`` node and was missing the initial pragma
  42. node (which is currently empty for an enum).
  43. - ``macros.getTypeImpl`` now correctly returns the implementation for a symbol
  44. of type ``tyGenericBody``.
  45. - If the dispatcher parameter's value used in multi method is ``nil``,
  46. a ``NilError`` exception is raised. The old behavior was that the method
  47. would be a ``nop`` then.
  48. - ``posix.nim``: the family of ``ntohs`` procs now takes unsigned integers
  49. instead of signed integers.
  50. - In Nim identifiers en-dash (Unicode point U+2013) is not an alias for the
  51. underscore anymore. Use underscores and fix your programming font instead.
  52. - When the ``requiresInit`` pragma is applied to a record type, future versions
  53. of Nim will also require you to initialize all the fields of the type during
  54. object construction. For now, only a warning will be produced.
  55. - The Object construction syntax now performs a number of additional safety
  56. checks. When fields within case objects are initialiazed, the compiler will
  57. now demand that the respective discriminator field has a matching known
  58. compile-time value.
  59. - On posix, the results of `waitForExit`, `peekExitCode`, `execCmd` will return
  60. 128 + signal number if the application terminates via signal.
  61. - ``ospaths.getConfigDir`` now conforms to the XDG Base Directory specification
  62. on non-Windows OSs. It returns the value of the XDG_CONFIG_DIR environment
  63. variable if it is set, and returns the default configuration directory,
  64. "~/.config/", otherwise.
  65. Library Additions
  66. -----------------
  67. - Added ``system.onThreadDestruction``.
  68. - Added ``dial`` procedure to networking modules: ``net``, ``asyncdispatch``,
  69. ``asyncnet``. It merges socket creation, address resolution, and connection
  70. into single step. When using ``dial``, you don't have to worry about
  71. IPv4 vs IPv6 problem. ``httpclient`` now supports IPv6.
  72. Tool Additions
  73. --------------
  74. - The ``finish`` tool can now download MingW for you should it not find a
  75. working MingW installation.
  76. Compiler Additions
  77. ------------------
  78. - The name mangling rules used by the C code generator changed. Most of the time
  79. local variables and parameters are not mangled at all anymore. This improves
  80. debugging experience.
  81. - The compiler produces explicit name mangling files when ``--debugger:native``
  82. is enabled. Debuggers can read these ``.ndi`` files in order to improve
  83. debugging Nim code.
  84. Language Additions
  85. ------------------
  86. - The ``try`` statement's ``except`` branches now support the binding of a
  87. caught exception to a variable:
  88. .. code-block:: nim
  89. try:
  90. raise newException(Exception, "Hello World")
  91. except Exception as exc:
  92. echo(exc.msg)
  93. This replaces the ``getCurrentException`` and ``getCurrentExceptionMsg()``
  94. procedures, although these procedures will remain in the stdlib for the
  95. foreseeable future. This new language feature is actually implemented using
  96. these procedures.
  97. In the near future we will be converting all exception types to refs to
  98. remove the need for the ``newException`` template.
  99. - A new pragma ``.used`` can be used for symbols to prevent
  100. the "declared but not used" warning. More details can be
  101. found `here <http://nim-lang.org/docs/manual.html#pragmas-used-pragma>`_.
  102. - The popular "colon block of statements" syntax is now also supported for
  103. ``let`` and ``var`` statements and assignments:
  104. .. code-block:: nim
  105. template ve(value, effect): untyped =
  106. effect
  107. val
  108. let x = ve(4):
  109. echo "welcome to Nim!"
  110. This is particularly useful for DSLs that help in tree construction.
  111. Language changes
  112. ----------------
  113. - The ``.procvar`` annotation is not required anymore. That doesn't mean you
  114. can pass ``system.$`` to ``map`` just yet though.
  115. Bugfixes
  116. --------
  117. The list below has been generated based on the commits in Nim's git
  118. repository. As such it lists only the issues which have been closed
  119. via a commit, for a full list see
  120. `this link on Github <https://github.com/nim-lang/Nim/issues?utf8=%E2%9C%93&q=is%3Aissue+closed%3A%222017-01-07+..+2017-02-06%22+>`_.
  121. - Fixed "Weird compilation bug"
  122. (`#4884 <https://github.com/nim-lang/Nim/issues/4884>`_)
  123. - Fixed "Return by arg optimization does not set result to default value"
  124. (`#5098 <https://github.com/nim-lang/Nim/issues/5098>`_)
  125. - Fixed "upcoming asyncdispatch doesn't remove recv callback if remote side closed socket"
  126. (`#5128 <https://github.com/nim-lang/Nim/issues/5128>`_)
  127. - Fixed "compiler bug, executable writes into wrong memory"
  128. (`#5218 <https://github.com/nim-lang/Nim/issues/5218>`_)
  129. - Fixed "Module aliasing fails when multiple modules have the same original name"
  130. (`#5112 <https://github.com/nim-lang/Nim/issues/5112>`_)
  131. - Fixed "JS: var argument + case expr with arg = bad codegen"
  132. (`#5244 <https://github.com/nim-lang/Nim/issues/5244>`_)
  133. - Fixed "compiler reject proc's param shadowing inside template"
  134. (`#5225 <https://github.com/nim-lang/Nim/issues/5225>`_)
  135. - Fixed "const value not accessible in proc"
  136. (`#3434 <https://github.com/nim-lang/Nim/issues/3434>`_)
  137. - Fixed "Compilation regression 0.13.0 vs 0.16.0 in compile-time evaluation"
  138. (`#5237 <https://github.com/nim-lang/Nim/issues/5237>`_)
  139. - Fixed "Regression: JS: wrong field-access codegen"
  140. (`#5234 <https://github.com/nim-lang/Nim/issues/5234>`_)
  141. - Fixed "fixes #5234"
  142. (`#5240 <https://github.com/nim-lang/Nim/issues/5240>`_)
  143. - Fixed "JS Codegen: duplicated fields in object constructor"
  144. (`#5271 <https://github.com/nim-lang/Nim/issues/5271>`_)
  145. - Fixed "RFC: improving JavaScript FFI"
  146. (`#4873 <https://github.com/nim-lang/Nim/issues/4873>`_)
  147. - Fixed "Wrong result type when using bitwise and"
  148. (`#5216 <https://github.com/nim-lang/Nim/issues/5216>`_)
  149. - Fixed "upcoming.asyncdispatch is prone to memory leaks"
  150. (`#5290 <https://github.com/nim-lang/Nim/issues/5290>`_)
  151. - Fixed "Using threadvars leads to crash on Windows when threads are created/destroyed"
  152. (`#5301 <https://github.com/nim-lang/Nim/issues/5301>`_)
  153. - Fixed "Type inferring templates do not work with non-ref types."
  154. (`#4973 <https://github.com/nim-lang/Nim/issues/4973>`_)
  155. - Fixed "Nimble package list no longer works on lib.html"
  156. (`#5318 <https://github.com/nim-lang/Nim/issues/5318>`_)
  157. - Fixed "Missing file name and line number in error message"
  158. (`#4992 <https://github.com/nim-lang/Nim/issues/4992>`_)
  159. - Fixed "ref type can't be converted to var parameter in VM"
  160. (`#5327 <https://github.com/nim-lang/Nim/issues/5327>`_)
  161. - Fixed "nimweb ignores the value of --parallelBuild"
  162. (`#5328 <https://github.com/nim-lang/Nim/issues/5328>`_)
  163. - Fixed "Cannot unregister/close AsyncEvent from within its handler"
  164. (`#5331 <https://github.com/nim-lang/Nim/issues/5331>`_)
  165. - Fixed "name collision with template instanciated generic inline function with inlined iterator specialization used from different modules"
  166. (`#5285 <https://github.com/nim-lang/Nim/issues/5285>`_)
  167. - Fixed "object in VM does not have value semantic"
  168. (`#5269 <https://github.com/nim-lang/Nim/issues/5269>`_)
  169. - Fixed "Unstable tuple destructuring behavior in Nim VM"
  170. (`#5221 <https://github.com/nim-lang/Nim/issues/5221>`_)
  171. - Fixed "nre module breaks os templates"
  172. (`#4996 <https://github.com/nim-lang/Nim/issues/4996>`_)
  173. - Fixed "Cannot implement distinct seq with setLen"
  174. (`#5090 <https://github.com/nim-lang/Nim/issues/5090>`_)
  175. - Fixed "await inside array/dict literal produces invalid code"
  176. (`#5314 <https://github.com/nim-lang/Nim/issues/5314>`_)
  177. - Fixed "asyncdispatch.accept() can raise exception inside poll() instead of failing future on Windows"
  178. (`#5279 <https://github.com/nim-lang/Nim/issues/5279>`_)
  179. - Fixed "VM: A crash report should be more informative"
  180. (`#5352 <https://github.com/nim-lang/Nim/issues/5352>`_)
  181. - Fixed "IO routines are poor at handling errors"
  182. (`#5349 <https://github.com/nim-lang/Nim/issues/5349>`_)
  183. - Fixed "new import syntax doesn't work?"
  184. (`#5185 <https://github.com/nim-lang/Nim/issues/5185>`_)
  185. - Fixed "Seq of object literals skips unmentioned fields"
  186. (`#5339 <https://github.com/nim-lang/Nim/issues/5339>`_)
  187. - Fixed "``sym is not accessible`` in compile time"
  188. (`#5354 <https://github.com/nim-lang/Nim/issues/5354>`_)
  189. - Fixed "the matching is broken in re.nim"
  190. (`#5382 <https://github.com/nim-lang/Nim/issues/5382>`_)
  191. - Fixed "development branch breaks in my c wrapper"
  192. (`#5392 <https://github.com/nim-lang/Nim/issues/5392>`_)
  193. - Fixed "Bad codegen: toSeq + tuples + generics"
  194. (`#5383 <https://github.com/nim-lang/Nim/issues/5383>`_)
  195. - Fixed "Bad codegen: toSeq + tuples + generics"
  196. (`#5383 <https://github.com/nim-lang/Nim/issues/5383>`_)
  197. - Fixed "Codegen error when using container of containers"
  198. (`#5402 <https://github.com/nim-lang/Nim/issues/5402>`_)
  199. - Fixed "sizeof(RangeType) is not available in static context"
  200. (`#5399 <https://github.com/nim-lang/Nim/issues/5399>`_)
  201. - Fixed "Regression: ICE: expr: var not init ex_263713"
  202. (`#5405 <https://github.com/nim-lang/Nim/issues/5405>`_)
  203. - Fixed "Stack trace is wrong when assignment operator fails with template"
  204. (`#5400 <https://github.com/nim-lang/Nim/issues/5400>`_)
  205. - Fixed "SIGSEGV in compiler"
  206. (`#5391 <https://github.com/nim-lang/Nim/issues/5391>`_)
  207. - Fixed "Compiler regression with struct member names"
  208. (`#5404 <https://github.com/nim-lang/Nim/issues/5404>`_)
  209. - Fixed "Regression: compiler segfault"
  210. (`#5419 <https://github.com/nim-lang/Nim/issues/5419>`_)
  211. - Fixed "The compilation of jester routes is broken on devel"
  212. (`#5417 <https://github.com/nim-lang/Nim/issues/5417>`_)
  213. - Fixed "Non-generic return type produces "method is not a base""
  214. (`#5432 <https://github.com/nim-lang/Nim/issues/5432>`_)
  215. - Fixed "Confusing error behavior when calling slice[T].random"
  216. (`#5430 <https://github.com/nim-lang/Nim/issues/5430>`_)
  217. - Fixed "Wrong method called"
  218. (`#5439 <https://github.com/nim-lang/Nim/issues/5439>`_)
  219. - Fixed "Attempt to document the strscans.scansp macro"
  220. (`#5154 <https://github.com/nim-lang/Nim/issues/5154>`_)
  221. - Fixed "[Regression] Invalid C code for _ symbol inside jester routes"
  222. (`#5452 <https://github.com/nim-lang/Nim/issues/5452>`_)
  223. - Fixed "StdLib base64 encodeInternal crashes with out of bound exception"
  224. (`#5457 <https://github.com/nim-lang/Nim/issues/5457>`_)
  225. - Fixed "Nim hangs forever in infinite loop in nre library"
  226. (`#5444 <https://github.com/nim-lang/Nim/issues/5444>`_)
  227. - Fixed "Tester passes test although individual test in suite fails"
  228. (`#5472 <https://github.com/nim-lang/Nim/issues/5472>`_)
  229. - Fixed "terminal.nim documentation"
  230. (`#5483 <https://github.com/nim-lang/Nim/issues/5483>`_)
  231. - Fixed "Codegen error - expected identifier before ')' token (probably regression)"
  232. (`#5481 <https://github.com/nim-lang/Nim/issues/5481>`_)
  233. - Fixed "mixin not works inside generic proc generated by template"
  234. (`#5478 <https://github.com/nim-lang/Nim/issues/5478>`_)
  235. - Fixed "var not init (converter + template + macro)"
  236. (`#5467 <https://github.com/nim-lang/Nim/issues/5467>`_)
  237. - Fixed "`==` for OrderedTable should consider equal content but different size as equal."
  238. (`#5487 <https://github.com/nim-lang/Nim/issues/5487>`_)
  239. - Fixed "Fixed tests/tester.nim"
  240. (`#45 <https://github.com/nim-lang/Nim/issues/45>`_)
  241. - Fixed "template instanciation crashes compiler"
  242. (`#5428 <https://github.com/nim-lang/Nim/issues/5428>`_)
  243. - Fixed "Internal compiler error in handleGenericInvocation"
  244. (`#5167 <https://github.com/nim-lang/Nim/issues/5167>`_)
  245. - Fixed "compiler crash in forwarding template"
  246. (`#5455 <https://github.com/nim-lang/Nim/issues/5455>`_)
  247. - Fixed "Doc query re public/private + suggestion re deprecated"
  248. (`#5529 <https://github.com/nim-lang/Nim/issues/5529>`_)
  249. - Fixed "inheritance not work for generic object whose parent is parameterized"
  250. (`#5264 <https://github.com/nim-lang/Nim/issues/5264>`_)
  251. - Fixed "weird inheritance rule restriction"
  252. (`#5231 <https://github.com/nim-lang/Nim/issues/5231>`_)
  253. - Fixed "Enum with holes broken in JS"
  254. (`#5062 <https://github.com/nim-lang/Nim/issues/5062>`_)
  255. - Fixed "enum type and aliased enum type inequality when tested with operator `is` involving template"
  256. (`#5360 <https://github.com/nim-lang/Nim/issues/5360>`_)
  257. - Fixed "logging: problem with console logger caused by the latest changes in sysio"
  258. (`#5546 <https://github.com/nim-lang/Nim/issues/5546>`_)
  259. - Fixed "Crash if proc and caller doesn't define seq type - HEAD"
  260. (`#4756 <https://github.com/nim-lang/Nim/issues/4756>`_)
  261. - Fixed "`path` config option doesn't work when compilation is invoked from a different directory"
  262. (`#5228 <https://github.com/nim-lang/Nim/issues/5228>`_)
  263. - Fixed "segfaults module doesn't compile with C++ backend"
  264. (`#5550 <https://github.com/nim-lang/Nim/issues/5550>`_)
  265. - Fixed "Improve `joinThreads` for windows"
  266. (`#4972 <https://github.com/nim-lang/Nim/issues/4972>`_)
  267. - Fixed "Compiling in release mode prevents valid code execution."
  268. (`#5296 <https://github.com/nim-lang/Nim/issues/5296>`_)
  269. - Fixed "Forward declaration of generic procs or iterators doesn't work"
  270. (`#4104 <https://github.com/nim-lang/Nim/issues/4104>`_)
  271. - Fixed "cant create thread after join"
  272. (`#4719 <https://github.com/nim-lang/Nim/issues/4719>`_)
  273. - Fixed "can't compile with var name "near" and --threads:on"
  274. (`#5598 <https://github.com/nim-lang/Nim/issues/5598>`_)
  275. - Fixed "inconsistent behavior when calling parent's proc of generic object"
  276. (`#5241 <https://github.com/nim-lang/Nim/issues/5241>`_)
  277. - Fixed "The problem with import order of asyncdispatch and unittest modules"
  278. (`#5597 <https://github.com/nim-lang/Nim/issues/5597>`_)
  279. - Fixed "Generic code fails to compile in unexpected ways"
  280. (`#976 <https://github.com/nim-lang/Nim/issues/976>`_)
  281. - Fixed "Another 'User defined type class' issue"
  282. (`#1128 <https://github.com/nim-lang/Nim/issues/1128>`_)
  283. - Fixed "compiler fails to compile user defined typeclass"
  284. (`#1147 <https://github.com/nim-lang/Nim/issues/1147>`_)
  285. - Fixed "Type class membership testing doesn't work on instances of generic object types"
  286. (`#1570 <https://github.com/nim-lang/Nim/issues/1570>`_)
  287. - Fixed "Strange overload resolution behavior for procedures with typeclass arguments"
  288. (`#1991 <https://github.com/nim-lang/Nim/issues/1991>`_)
  289. - Fixed "The same UDTC can't constrain two type parameters in the same procedure"
  290. (`#2018 <https://github.com/nim-lang/Nim/issues/2018>`_)
  291. - Fixed "More trait/concept issues"
  292. (`#2423 <https://github.com/nim-lang/Nim/issues/2423>`_)
  293. - Fixed "Bugs with concepts?"
  294. (`#2882 <https://github.com/nim-lang/Nim/issues/2882>`_)