--- - branch: MAIN date: Tue Apr 3 03:24:56 UTC 2018 files: - new: '1.4' old: '1.3' path: pkgsrc/lang/nim/Makefile pathrev: pkgsrc/lang/nim/Makefile@1.4 type: modified - new: '1.3' old: '1.2' path: pkgsrc/lang/nim/PLIST pathrev: pkgsrc/lang/nim/PLIST@1.3 type: modified - new: '1.3' old: '1.2' path: pkgsrc/lang/nim/distinfo pathrev: pkgsrc/lang/nim/distinfo@1.3 type: modified id: 20180403T032456Z.c5bbaf7afac33f99fcccf5d84316598bfe35ad2b log: "Update to 0.18.0\n\nChangelog:\n0.18.0:\nChanges affecting backwards compatibility\nBreaking changes in the standard library\n\n The [] proc for strings now raises an IndexError exception when the specified slice is out of bounds. See issue #6223 for more details. You can use substr(str, start, finish) to get the old behaviour back, see this commit for an example.\n\n strutils.split and strutils.rsplit with an empty string and a separator now returns that empty string. See issue #4377.\n\n \ Arrays of char cannot be converted to cstring anymore, pointers to arrays of char can! This means $ for arrays can finally exist in system.nim and do the right thing. This means $myArrayOfChar changed its behaviour! Compile with -d:nimNoArrayToString to see where to fix your code.\n\n reExtended is no longer default for the re constructor in the re module.\n\n The behavior of $ has been changed for all standard library collections. The collection-to-string implementations now perform proper quoting and escaping of strings and chars.\n\n newAsyncSocket taking an AsyncFD now runs setBlocking(false) on the fd.\n\n mod and bitwise and do not produce range subtypes anymore. This turned out to be more harmful than helpful and the language is simpler without this special typing rule.\n\n \ formatFloat/formatBiggestFloat now support formatting floats with zero precision digits. The previous precision = 0 behavior (default formatting) is now available via precision = -1.\n Moved from stdlib into Nimble packages:\n basic2d deprecated: use glm, arraymancer, neo, or another package instead\n basic3d deprecated: use glm, arraymancer, neo, or another package instead\n gentabs\n \ libuv\n polynumeric\n pdcurses\n romans\n libsvm\n \ joyent_http_parser\n\n Proc toCountTable now produces a CountTable with values correspoding to the number of occurrences of the key in the input. It used to produce a table with all values set to 1.\n\n Counting occurrences in a sequence used to be:\n\n let mySeq = @[1, 2, 1, 3, 1, 4]\n var myCounter = initCountTable[int]()\n\n for item in mySeq:\n myCounter.inc item\n\n \ Now, you can simply do:\n\n let\n mySeq = @[1, 2, 1, 3, 1, 4]\n myCounter = mySeq.toCountTable()\n\n If you use --dynlibOverride:ssl with OpenSSL 1.0.x, you now have to define openssl10 symbol (-d:openssl10). By default OpenSSL 1.1.x is assumed.\n\n newNativeSocket is now named createNativeSocket.\n\n newAsyncNativeSocket is now named createAsyncNativeSocket and it no longer raises an OS error but returns an osInvalidSocket when creation fails.\n\n The securehash module is now deprecated. Instead import std / sha1.\n The readPasswordFromStdin proc has been moved from the rdstdin to the terminal module, thus it does not depend on linenoise anymore.\n\nBreaking changes in the compiler\n\n \\n is now only the single line feed character like in most other programming languages. The new platform specific newline escape sequence is written as \\p. This change only affects the Windows platform.\n\n The overloading rules changed slightly so that constrained generics are preferred over unconstrained generics. (Bug #6526)\n\n We changed how array accesses 窶彷rom backwards窶� like a[^1] or a[0..^1] are implemented. These are now implemented purely in system.nim without compiler support. There is a new 窶å¾\x82eterogenous窶� slice type system.HSlice that takes 2 generic parameters which can be BackwardsIndex indices. BackwardsIndex is produced by system.^. This means if you overload [] or []= you need to ensure they also work with system.BackwardsIndex (if applicable for the accessors).\n\n The parsing rules of if expressions were changed so that multiple statements are allowed in the branches. We found few code examples that now fail because of this change, but here is one:\n\n t[ti] = if exp_negative: '-' else: '+'; inc(ti)\n\n This now needs to be written as:\n\n t[ti] = (if exp_negative: '-' else: '+'); inc(ti)\n\n \ The experimental overloading of the dot . operators now take an untyped parameter as the field name, it used to be a static[string]. You can use when defined(nimNewDot) to make your code work with both old and new Nim versions. See special-operators for more information.\n\n yield (or await which is mapped to yield) never worked reliably in an array, seq or object constructor and is now prevented at compile-time.\n\nLibrary additions\n\n Added sequtils.mapLiterals for easier construction of array and tuple literals.\n\n Added system.runnableExamples to make examples in Nim窶å\x86± documentation easier to write and test. The examples are tested as the last step of nim doc.\n\n Implemented getIoHandler proc in the asyncdispatch module that allows you to retrieve the underlying IO Completion Port or Selector[AsyncData] object in the specified dispatcher.\n\n For string formatting / interpolation a new module called strformat has been added to the stdlib.\n\n The ReadyKey type in the selectors module now contains an errorCode field to help distinguish between Event.Error events.\n\n Implemented an accept proc that works on a SocketHandle in nativesockets.\n\n Added algorithm.rotateLeft.\n\n Added typetraits.$ as an alias for typetraits.name.\n\n Added system.getStackTraceEntries that allows you to access the stack trace in a structured manner without string parsing.\n\n Added parseutils.parseSaturatedNatural.\n\n Added macros.unpackVarargs.\n\n \ Added support for asynchronous programming for the JavaScript backend using the asyncjs module.\n\n Added true color support for some terminals. Example:\n\n \ import colors, terminal\n\n const Nim = \"Efficient and expressive programming.\"\n\n \ var\n fg = colYellow\n bg = colBlue\n int = 1.0\n\n enableTrueColors()\n\n \ for i in 1..15:\n styledEcho bgColor, bg, fgColor, fg, Nim, resetStyle\n \ int -= 0.01\n fg = intensity(fg, int)\n\n setForegroundColor colRed\n \ setBackgroundColor colGreen\n styledEcho \"Red on Green.\", resetStyle\n\nLibrary changes\n\n echo now works with strings that contain \\0 (the binary zero is not shown) and nil strings are equal to empty strings.\n\n JSON: Deprecated getBVal, getFNum, and getNum in favour of getBool, getFloat, getBiggestInt. A new getInt procedure was also added.\n\n rationals.toRational now uses an algorithm based on continued fractions. This means its results are more precise and it can窶å\x86² run into an infinite loop anymore.\n\n os.getEnv now takes an optional default parameter that tells getEnv what to return if the environment variable does not exist.\n\n The random procs in random.nim have all been deprecated. Instead use the new rand procs. The module now exports the state of the random number generator as type Rand so multiple threads can easily use their own random number generators that do not require locking. For more information about this rename see issue #6934\n\n writeStackTrace is now proclaimed to have no IO effect (even though it does) so that it is more useful for debugging purposes.\n\n db_mysql module: DbConn is now a distinct type that doesn窶å\x86² expose the details of the underlying PMySQL type.\n\n parseopt2 is now deprecated, use parseopt instead.\n\nLanguage additions\n\n It is now possible to forward declare object types so that mutually recursive types can be created across module boundaries. See package level objects for more information.\n\n Added support for casting between integers of same bitsize in VM (compile time and nimscript). This allows to, among other things, reinterpret signed integers as unsigned.\n\n Custom pragmas are now supported using pragma pragma, please see language manual for details.\n\n Standard library modules can now also be imported via the std pseudo-directory. This is useful in order to distinguish between standard library and nimble package imports:\n\n \ import std / [strutils, os, osproc]\n import someNimblePackage / [strutils, os]\n\nLanguage changes\n\n The unary < is now deprecated, for .. < use ..< for other usages use the pred proc.\n\n Bodies of for loops now get their own scope:\n\n # now compiles:\n for i in 0..4:\n let i = i + 1\n echo i\n\n To make Nim even more robust the system iterators .. and countup now only accept a single generic type T. This means the following code doesn窶å\x86² die with an 窶å¾\x99ut of range窶� error anymore:\n\n var b = 5.Natural\n \ var a = -5\n for i in a..b:\n echo i\n\n atomic and generic are no longer keywords in Nim. generic used to be an alias for concept, atomic was not used for anything.\n\n The memory manager now uses a variant of the TLSF algorithm that has much better memory fragmentation behaviour. According to http://www.gii.upv.es/tlsf/ the maximum fragmentation measured is lower than 25%. As a nice bonus alloc and dealloc became O(1) operations.\n\n The compiler is now more consistent in its treatment of ambiguous symbols: Types that shadow procs and vice versa are marked as ambiguous (bug #6693).\n\n codegenDecl pragma now works for the JavaScript backend. It returns an empty string for function return type placeholders.\n\n \ Extra semantic checks for procs with noreturn pragma: return type is not allowed, statements after call to noreturn procs are no longer allowed.\n Noreturn proc calls and raising exceptions branches are now skipped during common type deduction in if and case expressions. The following code snippets now compile:\n\n import strutils\n let str = \"Y\"\n let a = case str:\n of \"Y\": true\n of \"N\": false\n else: raise newException(ValueError, \"Invalid boolean\")\n \ let b = case str:\n of nil, \"\": raise newException(ValueError, \"Invalid boolean\")\n elif str.startsWith(\"Y\"): true\n elif str.startsWith(\"N\"): false\n else: false\n let c = if str == \"Y\": true\n elif str == \"N\": false\n else:\n echo \"invalid bool\"\n quit(\"this is the end\")\n\n Pragmas now support call syntax, for example: {.exportc\"myname\".} and {.exportc(\"myname\").}\n\n The deprecated pragma now supports a user-definable warning message for procs.\n\n proc bar {.deprecated: \"use foo instead\".} =\n return\n\n bar()\n\nTool changes\n\n The nim doc command is now an alias for nim doc2, the second version of the documentation generator. The old version 1 can still be accessed via the new nim doc0 command.\n\n Nim窶å\x86± rst2html command now supports the testing of code snippets via an RST extension that we called :test:::\n\n .. code-block:: nim\n :test:\n # shows how the 'if' statement works\n if true: echo \"yes\"\n\n0.17.0:\nChanges affecting backwards compatibility\n\n There are now two different HTTP response types, Response and AsyncResponse. AsyncResponse窶å\x86± body accessor returns a Future[string]!\n\n Due to this change you may need to add another await in your code.\n httpclient.request now respects the maxRedirects option. Previously redirects were handled only by get and post procs.\n The IO routines now raise EOFError for the 窶彳nd of file窶� condition. EOFError is a subtype of IOError and so it窶å\x86± easier to distinguish between 窶彳rror during read窶� and 窶彳rror due to EOF窶�.\n A hash procedure has been added for cstring type in hashes module. Previously, hash of a cstring would be calculated as a hash of the pointer. Now the hash is calculated from the contents of the string, assuming cstring is a null-terminated string. Equal string and cstring values produce an equal hash value.\n Macros accepting varargs arguments will now receive a node having the nkArgList node kind. Previous code expecting the node kind to be nkBracket may have to be updated.\n memfiles.open now closes file handles/fds by default. Passing allowRemap=true to memfiles.open recovers the old behavior. The old behavior is only needed to call mapMem on the resulting MemFile.\n posix.nim: For better C++ interop the field sa_sigaction*: proc (x: cint, y: var SigInfo, z: pointer) {.noconv.} was changed to sa_sigaction*: proc (x: cint, y: ptr SigInfo, z: pointer) {.noconv.}.\n The compiler doesn窶å\x86² infer effects for .base methods anymore. This means you need to annotate them with .gcsafe or similar to clearly declare upfront every implementation needs to fullfill these contracts.\n system.getAst templateCall(x, y) now typechecks the templateCall properly. You need to patch your code accordingly.\n macros.getType and macros.getTypeImpl for an enum will now return an AST that is the same as what is used to define an enum. Previously the AST returned had a repeated EnumTy node and was missing the initial pragma node (which is currently empty for an enum).\n macros.getTypeImpl now correctly returns the implementation for a symbol of type tyGenericBody.\n If the dispatcher parameter窶å\x86± value used in multi method is nil, a NilError exception is raised. The old behavior was that the method would be a nop then.\n posix.nim: the family of ntohs procs now takes unsigned integers instead of signed integers.\n In Nim identifiers en-dash (Unicode point U+2013) is not an alias for the underscore anymore. Use underscores instead.\n When the requiresInit pragma is applied to a record type, future versions of Nim will also require you to initialize all the fields of the type during object construction. For now, only a warning will be produced.\n \ The Object construction syntax now performs a number of additional safety checks. When fields within case objects are initialiazed, the compiler will now demand that the respective discriminator field has a matching known compile-time value.\n On posix, the results of waitForExit, peekExitCode, execCmd will return 128 + signal number if the application terminates via signal.\n ospaths.getConfigDir now conforms to the XDG Base Directory specification on non-Windows OSs. It returns the value of the XDG_CONFIG_DIR environment variable if it is set, and returns the default configuration directory, 窶æ\x81 /.config/窶�, otherwise.\n Renamed the line info node parameter for newNimNode procedure.\n\n The parsing rules of do changed.\n\n foo bar do:\n baz\n\n Used to be parsed as:\n\n \ foo(bar(do:\n baz))\n\n Now it is parsed as:\n\n foo(bar, do:\n baz)\n\nLibrary Additions\n\n Added system.onThreadDestruction.\n\n \ Added dial procedure to networking modules: net, asyncdispatch, asyncnet. It merges socket creation, address resolution, and connection into single step. When using dial, you don窶å\x86² have to worry about the IPv4 vs IPv6 problem. httpclient now supports IPv6.\n\n Added to macro which allows JSON to be unmarshalled into a type.\n\n import json\n\n type\n Person = object\n name: string\n age: int\n\n let data = \"\"\"\n {\n \"name\": \"Amy\",\n \"age\": 4\n }\n \"\"\"\n\n let node = parseJson(data)\n \ let obj = node.to(Person)\n echo(obj)\n\nTool Additions\n\n The finish tool can now download MingW for you should it not find a working MingW installation.\n\nCompiler Additions\n\n The name mangling rules used by the C code generator changed. Most of the time local variables and parameters are not mangled at all anymore. This improves the debugging experience.\n The compiler produces explicit name mangling files when --debugger:native is enabled. Debuggers can read these .ndi files in order to improve debugging Nim code.\n\nLanguage Additions\n\n The try statement窶å\x86± except branches now support the binding of a caught exception to a variable:\n\n try:\n raise newException(Exception, \"Hello World\")\n except Exception as exc:\n echo(exc.msg)\n\n \ This replaces the getCurrentException and getCurrentExceptionMsg() procedures, although these procedures will remain in the stdlib for the foreseeable future. This new language feature is actually implemented using these procedures.\n\n \ In the near future we will be converting all exception types to refs to remove the need for the newException template.\n A new pragma .used can be used for symbols to prevent the 窶彭eclared but not used窶� warning. More details can be found here.\n\n The popular 窶彡olon block of statements窶� syntax is now also supported for let and var statements and assignments:\n\n template ve(value, effect): untyped =\n effect\n value\n\n let x = ve(4):\n \ echo \"welcome to Nim!\"\n\n This is particularly useful for DSLs that help in tree construction.\n\nLanguage changes\n\n The .procvar annotation is not required anymore. That doesn窶å\x86² mean you can pass system.$ to map just yet though.\n" module: pkgsrc subject: 'CVS commit: pkgsrc/lang/nim' unixtime: '1522725896' user: ryoon