Commit graph

5 commits

Author SHA1 Message Date
ryoon
9ff16a98cc Update to 0.19
Changelog:
What’s new in 0.19.0

The nil state for strings/seqs is gone. Instead the default value for these is "" / @[]. Use --nilseqs:on for a transition period. This eliminates a large class of bugs that used to plague the average Nim code out there, including Nim’s standard library.

Accessing the binary zero terminator in Nim’s native strings is now invalid. Internally a Nim string still has the trailing zero for zero-copy interoperability with cstring. Compile your code with the new switch --laxStrings:on if you need a transition period.

These changes to strings and seqs give us more flexibility in how they are implemented and indeed alternative implementations are in development.

experimental is now a pragma and a command line switch that can enable specific language extensions, it is not an all-or-nothing switch anymore. We think this leads to a more robust development process where it’s clearly documented which parts of Nim are bleeding edge and which parts can be relied upon.

Other notable language additions:

    Dot calls combined with explicit generic instantiations can now be written as x.y[:z] which is transformed into y[z](x) by the parser.
    func is now an alias for proc {.noSideEffect.}.

    Anonymous tuples with a single element can now be written as (1,) with a trailing comma.

    In order to make for loops and iterators more flexible to use Nim now supports so called “for-loop macros”. See the manual for more details. This feature enables a Python-like generic enumerate implementation.

    Case statements can now be rewritten via macros. See the manual for more information. This feature enables custom pattern matching.

    The command syntax now supports keyword arguments after the first comma.

    Thread-local variables can now be declared inside procs. This implies all the effects of the global pragma.

    Nim now supports the except clause in the export statement.
    Range float types, example range[0.0 .. Inf]. More details in language manual.

Breaking changes to be mindful of

    The default location of nimcache for the native code targets was changed. Read the compiler user guide for more information.
    Lots of deprecated symbols in the standard library that have been deprecated for quite some time now like system.expr or the old type aliases starting with a T or P prefix have been removed.
    The exception hierarchy was slightly reworked, SystemError was renamed to CatchableError and is the new base class for any exception that is guaranteed to be catchable. This change should have minimal impact on most existing Nim code.

Async improvements

The “closure iterators” that Nim’s async macro is based on has been rewritten from the ground up and so async works completely with exception handling. Finally it is possible to use await in a try statement!
Nimble 0.9.0

This release includes a brand new version of Nimble. The new version contains a breaking change which you should read up on if you own hybrid packages. There are also the usual bug fixes and this release contains a lot of them.
2018-10-01 12:50:42 +00:00
ryoon
a9e261bc9c Update to 0.18.0
Changelog:
0.18.0:
Changes affecting backwards compatibility
Breaking changes in the standard library

    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.

    strutils.split and strutils.rsplit with an empty string and a separator now returns that empty string. See issue #4377.

    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.

    reExtended is no longer default for the re constructor in the re module.

    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.

    newAsyncSocket taking an AsyncFD now runs setBlocking(false) on the fd.

    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.

    formatFloat/formatBiggestFloat now support formatting floats with zero precision digits. The previous precision = 0 behavior (default formatting) is now available via precision = -1.
    Moved from stdlib into Nimble packages:
        basic2d deprecated: use glm, arraymancer, neo, or another package instead
        basic3d deprecated: use glm, arraymancer, neo, or another package instead
        gentabs
        libuv
        polynumeric
        pdcurses
        romans
        libsvm
        joyent_http_parser

    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.

    Counting occurrences in a sequence used to be:

    let mySeq = @[1, 2, 1, 3, 1, 4]
    var myCounter = initCountTable[int]()

    for item in mySeq:
      myCounter.inc item

    Now, you can simply do:

    let
      mySeq = @[1, 2, 1, 3, 1, 4]
      myCounter = mySeq.toCountTable()

    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.

    newNativeSocket is now named createNativeSocket.

    newAsyncNativeSocket is now named createAsyncNativeSocket and it no longer raises an OS error but returns an osInvalidSocket when creation fails.

    The securehash module is now deprecated. Instead import std / sha1.
    The readPasswordFromStdin proc has been moved from the rdstdin to the terminal module, thus it does not depend on linenoise anymore.

Breaking changes in the compiler

    \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.

    The overloading rules changed slightly so that constrained generics are preferred over unconstrained generics. (Bug #6526)

    We changed how array accesses “from 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 “heterogenous” 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).

    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:

    t[ti] = if exp_negative: '-' else: '+'; inc(ti)

    This now needs to be written as:

    t[ti] = (if exp_negative: '-' else: '+'); inc(ti)

    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.

    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.

Library additions

    Added sequtils.mapLiterals for easier construction of array and tuple literals.

    Added system.runnableExamples to make examples in Nim’s documentation easier to write and test. The examples are tested as the last step of nim doc.

    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.

    For string formatting / interpolation a new module called strformat has been added to the stdlib.

    The ReadyKey type in the selectors module now contains an errorCode field to help distinguish between Event.Error events.

    Implemented an accept proc that works on a SocketHandle in nativesockets.

    Added algorithm.rotateLeft.

    Added typetraits.$ as an alias for typetraits.name.

    Added system.getStackTraceEntries that allows you to access the stack trace in a structured manner without string parsing.

    Added parseutils.parseSaturatedNatural.

    Added macros.unpackVarargs.

    Added support for asynchronous programming for the JavaScript backend using the asyncjs module.

    Added true color support for some terminals. Example:

    import colors, terminal

    const Nim = "Efficient and expressive programming."

    var
      fg = colYellow
      bg = colBlue
      int = 1.0

    enableTrueColors()

    for i in 1..15:
      styledEcho bgColor, bg, fgColor, fg, Nim, resetStyle
      int -= 0.01
      fg = intensity(fg, int)

    setForegroundColor colRed
    setBackgroundColor colGreen
    styledEcho "Red on Green.", resetStyle

Library changes

    echo now works with strings that contain \0 (the binary zero is not shown) and nil strings are equal to empty strings.

    JSON: Deprecated getBVal, getFNum, and getNum in favour of getBool, getFloat, getBiggestInt. A new getInt procedure was also added.

    rationals.toRational now uses an algorithm based on continued fractions. This means its results are more precise and it can’t run into an infinite loop anymore.

    os.getEnv now takes an optional default parameter that tells getEnv what to return if the environment variable does not exist.

    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

    writeStackTrace is now proclaimed to have no IO effect (even though it does) so that it is more useful for debugging purposes.

    db_mysql module: DbConn is now a distinct type that doesn’t expose the details of the underlying PMySQL type.

    parseopt2 is now deprecated, use parseopt instead.

Language additions

    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.

    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.

    Custom pragmas are now supported using pragma pragma, please see language manual for details.

    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:

    import std / [strutils, os, osproc]
    import someNimblePackage / [strutils, os]

Language changes

    The unary < is now deprecated, for .. < use ..< for other usages use the pred proc.

    Bodies of for loops now get their own scope:

    # now compiles:
    for i in 0..4:
      let i = i + 1
      echo i

    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’t die with an “out of range” error anymore:

    var b = 5.Natural
    var a = -5
    for i in a..b:
      echo i

    atomic and generic are no longer keywords in Nim. generic used to be an alias for concept, atomic was not used for anything.

    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.

    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).

    codegenDecl pragma now works for the JavaScript backend. It returns an empty string for function return type placeholders.

    Extra semantic checks for procs with noreturn pragma: return type is not allowed, statements after call to noreturn procs are no longer allowed.
    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:

    import strutils
    let str = "Y"
    let a = case str:
      of "Y": true
      of "N": false
      else: raise newException(ValueError, "Invalid boolean")
    let b = case str:
      of nil, "": raise newException(ValueError, "Invalid boolean")
      elif str.startsWith("Y"): true
      elif str.startsWith("N"): false
      else: false
    let c = if str == "Y": true
      elif str == "N": false
      else:
        echo "invalid bool"
        quit("this is the end")

    Pragmas now support call syntax, for example: {.exportc"myname".} and {.exportc("myname").}

    The deprecated pragma now supports a user-definable warning message for procs.

    proc bar {.deprecated: "use foo instead".} =
      return

    bar()

Tool changes

    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.

    Nim’s rst2html command now supports the testing of code snippets via an RST extension that we called :test:::

    .. code-block:: nim
        :test:
      # shows how the 'if' statement works
      if true: echo "yes"


0.17.0:
Changes affecting backwards compatibility

    There are now two different HTTP response types, Response and AsyncResponse. AsyncResponse’s body accessor returns a Future[string]!

    Due to this change you may need to add another await in your code.
    httpclient.request now respects the maxRedirects option. Previously redirects were handled only by get and post procs.
    The IO routines now raise EOFError for the “end of file” condition. EOFError is a subtype of IOError and so it’s easier to distinguish between “error during read” and “error due to EOF”.
    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.
    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.
    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.
    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.}.
    The compiler doesn’t 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.
    system.getAst templateCall(x, y) now typechecks the templateCall properly. You need to patch your code accordingly.
    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).
    macros.getTypeImpl now correctly returns the implementation for a symbol of type tyGenericBody.
    If the dispatcher parameter’s value used in multi method is nil, a NilError exception is raised. The old behavior was that the method would be a nop then.
    posix.nim: the family of ntohs procs now takes unsigned integers instead of signed integers.
    In Nim identifiers en-dash (Unicode point U+2013) is not an alias for the underscore anymore. Use underscores instead.
    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.
    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.
    On posix, the results of waitForExit, peekExitCode, execCmd will return 128 + signal number if the application terminates via signal.
    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, “~/.config/”, otherwise.
    Renamed the line info node parameter for newNimNode procedure.

    The parsing rules of do changed.

      foo bar do:
        baz

    Used to be parsed as:

      foo(bar(do:
        baz))

    Now it is parsed as:

      foo(bar, do:
        baz)

Library Additions

    Added system.onThreadDestruction.

    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’t have to worry about the IPv4 vs IPv6 problem. httpclient now supports IPv6.

    Added to macro which allows JSON to be unmarshalled into a type.

      import json

      type
        Person = object
          name: string
          age: int

      let data = """
        {
          "name": "Amy",
          "age": 4
        }
      """

      let node = parseJson(data)
      let obj = node.to(Person)
      echo(obj)

Tool Additions

    The finish tool can now download MingW for you should it not find a working MingW installation.

Compiler Additions

    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.
    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.

Language Additions

    The try statement’s except branches now support the binding of a caught exception to a variable:

        try:
          raise newException(Exception, "Hello World")
        except Exception as exc:
          echo(exc.msg)

    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.

    In the near future we will be converting all exception types to refs to remove the need for the newException template.
    A new pragma .used can be used for symbols to prevent the “declared but not used” warning. More details can be found here.

    The popular “colon block of statements” syntax is now also supported for let and var statements and assignments:

      template ve(value, effect): untyped =
        effect
        value

      let x = ve(4):
        echo "welcome to Nim!"

    This is particularly useful for DSLs that help in tree construction.

Language changes

    The .procvar annotation is not required anymore. That doesn’t mean you can pass system.$ to map just yet though.
2018-04-03 03:24:56 +00:00
wiz
3e75f0aaa2 Add HOMEPAGE. Prefer INSTALLATION_DIRS to AUTO_MKDIRS.
Fix pkglint warning.
2017-02-22 21:22:10 +00:00
kamil
e8a7461fbd Update nim from 0.14.2 to 0.16.0
Upstream changelog
==================

Changelog 0.16.0
Changes affecting backwards compatibility

    staticExec now uses the directory of the nim file that contains the staticExec call as the current working directory.
    TimeInfo.tzname has been removed from times module because it was broken. Because of this, the option "ZZZ" will no longer work in format strings for formatting and parsing.

Library Additions

    Added new parameter to error proc of macro module to provide better error message
    Added new deques module intended to replace queues. deques provides a superset of queues API with clear naming. queues module is now deprecated and will be removed in the future.
    Added hideCursor, showCursor, terminalWidth, terminalWidthIoctl and terminalSize to the terminal (doc) module.
    Added new module distros (doc) that can be used in Nimble packages to aid in supporting the OS's native package managers.

Tool Additions
Compiler Additions

    The C/C++ code generator has been rewritten to use stable name mangling rules. This means that compile times for edit-compile-run cycles are much reduced.

Language Additions

    The emit pragma now takes a list of Nim expressions instead of a single string literal. This list can easily contain non-strings like template parameters. This means emit works out of the box with templates and no new quoting rules needed to be introduced. The old way with backtick quoting is still supported but will be deprecated.

type Vector* {.importcpp: "std::vector", header: "<vector>".}[T] = object

template `[]=`*[T](v: var Vector[T], key: int, val: T) =
  {.emit: [v, "[", key, "] = ", val, ";"].}

proc setLen*[T](v: var Vector[T]; size: int) {.importcpp: "resize", nodecl.}
proc `[]`*[T](v: var Vector[T], key: int): T {.importcpp: "(#[#])", nodecl.}

proc main =
  var v: Vector[float]
  v.setLen 1
  v[0] = 6.0
  echo v[0]

    The import statement now supports importing multiple modules from the same directory:

import compiler / [ast, parser, lexer]

Is a shortcut for:

import compiler / ast, compiler / parser, compiler / lexer

Bugfixes

The list below has been generated based on the commits in Nim's git repository. As such it lists only the issues which have been closed via a commit, for a full list see this link on Github.

    Fixed "staticRead and staticExec have different working directories" (#4871)
    Fixed "CountTable doesn't support the '==' operator" (#4901)
    Fixed "documentation for module sequtls apply proc" (#4386)
    Fixed "Operator == for CountTable does not work." (#4946)
    Fixed "sysFatal (IndexError) with parseUri and the / operator" (#4959)
    Fixed "initialSize parameter does not work in OrderedTableRef" (#4940)
    Fixed "error proc from macro library could have a node parameter" (#4915)
    Fixed "Segfault when comparing OrderedTableRef with nil" (#4974)
    Fixed "Bad codegen when comparing isNil results" (#4975)
    Fixed "OrderedTable cannot delete entry with empty string or 0 key" (#5035)
    Fixed "Deleting specific keys from ordered table leaves it in invalid state." (#5057)
    Fixed "Paths are converted to lowercase on Windows" (#5076)
    Fixed "toTime(getGMTime(...)) doesn't work correctly when local timezone is not UTC" (#5065)
    Fixed "out of memory error from test= type proc call when parameter is a call to a table's [] proc" (#5079)
    Fixed "Incorrect field order in object construction" (#5055)
    Fixed "Incorrect codegen when importing nre with C++ backend (commit 8494338)" (#5081)
    Fixed "Templates, {.emit.}, and backtick interpolation do not work together" (#4730)
    Fixed "Regression: getType fails in certain cases" (#5129)
    Fixed "CreateThread doesn't accept functions with generics" (#43)
    Fixed "No instantiation information when template has error" (#4308)
    Fixed "realloc leaks" (#4818)
    Fixed "Regression: getType" (#5131)
    Fixed "Code generation for generics broken by sighashes" (#5135)
    Fixed "Regression: importc functions are not declared in generated C code" (#5136)
    Fixed "Calling split("") on string hangs program" (#5119)
    Fixed "Building dynamic library: undefined references (Linux)" (#4775)
    Fixed "Bad codegen for distinct + importc - sighashes regression" (#5137)
    Fixed "C++ codegen regression: memset called on a result variable of importcpp type" (#5140)
    Fixed "C++ codegen regression: using channels leads to broken C++ code" (#5142)
    Fixed "Ambiguous call when overloading var and non-var with generic type" (#4519)
    Fixed "[Debian]: build.sh error: unknown processor: aarch64" (#2147)
    Fixed "RFC: asyncdispatch.poll behaviour" (#5155)
    Fixed "Can't access enum members through alias (possible sighashes regression)" (#5148)
    Fixed "Type, declared in generic proc body, leads to incorrect codegen (sighashes regression)" (#5147)
    Fixed "Compiler SIGSEGV when mixing method and proc" (#5161)
    Fixed "Compile-time SIGSEGV when declaring .importcpp method with return value " (#3848)
    Fixed "Variable declaration incorrectly parsed" (#2050)
    Fixed "Invalid C code when naming a object member "linux"" (#5171)
    Fixed "[Windows] MinGW within Nim install is missing libraries" (#2723)
    Fixed "async: annoying warning for future.finished" (#4948)
    Fixed "new import syntax doesn't work?" (#5185)
    Fixed "Fixes #1994" (#4874)
    Fixed "Can't tell return value of programs with staticExec" (#1994)
    Fixed "startProcess() on Windows with poInteractive: Second call fails ("Alle Pipeinstanzen sind ausgelastet")" (#5179)


Version 0.15.2 released

We're happy to announce that the latest release of Nim, version 0.15.2, is now available!

As always, you can grab the latest version from the downloads page.

This release is a pure bugfix release fixing the most pressing issues and regressions of 0.15.0. For Windows we now provide zipfiles in addition to the NSIS based installer which proves to be hard to maintain and after all these months still has serious issues. So we encourage you download the .zip file instead of the .exe file! Unzip it somewhere, run finish.exe to detect your MingW installation, done. finish.exe can also set your PATH environment variable.
Bugfixes

The list below has been generated based on the commits in Nim's git repository. As such it lists only the issues which have been closed via a commit, for a full list see this link on Github.

    Fixed "NimMain not exported in DLL, but NimMainInner is" (#4840)
    Fixed "Tables clear seems to be broken" (#4844)
    Fixed "compiler: internal error" (#4845)
    Fixed "trivial macro breaks type checking in the compiler" (#4608)
    Fixed "derived generic types with static[T] breaks type checking in v0.15.0 (worked in v0.14.2)" (#4863)
    Fixed "xmlparser.parseXml is not recognised as GC-safe" (#4899)
    Fixed "async makes generics instantiate only once" (#4856)
    Fixed "db_common docs aren't generated" (#4895)
    Fixed "rdstdin disappeared from documentation index" (#3755)
    Fixed "ICE on template call resolution" (#4875)
    Fixed "Invisible code-block" (#3078)
    Fixed "nim doc does not generate doc comments correctly" (#4913)
    Fixed "nim doc2 fails on ARM when running against lib/pure/coro.nim" (#4879)
    Fixed "xmlparser does not unescape correctly" (#1518)
    Fixed "[docs] mysterious "raise hook"" (#3485)
    Fixed "assertion failure in non-release Nim when compiling NimYAML" (#4869)
    Fixed "A closure causes nimscript to fail with unhandled exception" (#4906)
    Fixed "startProcess changes working directory" (#4867)
    Fixed "bindsym to void template produces ICE" (#4808)
    Fixed "readline(TFile, var string) segfaults if second argument is nil" (#564)
    Fixed "times.parse gives the wrong day of the week for the first hour of the day." (#4922)
    Fixed "Internal error when passing parameter proc inside .gcsafe closure" (#4927)
    Fixed "Upcoming asyncdispatch doesn't compile with C++ backend on OS X" (#4928)



Changelog 0.15.0
Changes affecting backwards compatibility

    The json module now uses an OrderedTable rather than a Table for JSON objects.
    The split (doc) procedure in the strutils module (with a delimiter of type set[char]) no longer strips and splits characters out of the target string by the entire set of characters. Instead, it now behaves in a similar fashion to split with string and char delimiters. Use splitWhitespace to get the old behaviour.

    The command invocation syntax will soon apply to open brackets and curlies too. This means that code like a [i] will be interpreted as a([i]) and not as a[i] anymore. Likewise f (a, b) means that the tuple (a, b) is passed to f. The compiler produces a warning for a [i]:

    Warning: a [b] will be parsed as command syntax; spacing is deprecated

    See Issue #3898 for the relevant discussion.
    Overloading the special operators ., .(), .=, () now needs to be enabled via the {.experimental.} pragma.
    immediate templates and macros are now deprecated. Use untyped (doc) parameters instead.
    The metatype expr is deprecated. Use untyped (doc) instead.
    The metatype stmt is deprecated. Use typed (doc) instead.
    The compiler is now more picky when it comes to tuple types. The following code used to compile, now it's rejected:

import tables
var rocketaims = initOrderedTable[string, Table[tuple[k: int8, v: int8], int64]]()
rocketaims["hi"] = {(-1.int8, 0.int8): 0.int64}.toTable()

Instead be consistent in your tuple usage and use tuple names for named tuples:

import tables
var rocketaims = initOrderedTable[string, Table[tuple[k: int8, v: int8], int64]]()
rocketaims["hi"] = {(k: -1.int8, v: 0.int8): 0.int64}.toTable()

    Now when you compile console applications for Windows, console output encoding is automatically set to UTF-8.
    Unhandled exceptions in JavaScript are now thrown regardless of whether noUnhandledHandler is defined. But the stack traces should be much more readable now.
    In JavaScript, the system.alert procedure has been deprecated. Use dom.alert instead.
    De-deprecated re.nim because there is too much code using it and it got the basic API right.
    The type of headers field in the AsyncHttpClient type (doc) has been changed from a string table to the specialised HttpHeaders type.
    The httpclient.request (doc) procedure which takes the httpMethod as a string value no longer requires it to be prefixed with "http" (or similar).
    Converting a HttpMethod (doc) value to a string using the $ operator will give string values without the "Http" prefix now.
    The Request (doc) object defined in the asynchttpserver module now uses the HttpMethod type for the request method.

Library Additions

    Added readHeaderRow and rowEntry to the parsecsv (doc) module to provide a lightweight alternative to python's csv.DictReader.
    Added setStdIoUnbuffered proc to the system module to enable unbuffered I/O.
    Added center and rsplit to the strutils (doc) module to provide similar Python functionality for Nim's strings.
    Added isTitle, title, swapCase, isUpper, toUpper, isLower, toLower, isAlpha, isSpace, and capitalize to the unicode.nim (doc) module to provide unicode aware case manipulation and case testing.
    Added a new module strmisc (doc) to hold uncommon string operations. Currently contains partition, rpartition and expandTabs.
    Split out walkFiles in the os (doc) module to three separate procs in order to make a clear distinction of functionality. walkPattern iterates over both files and directories, while walkFiles now only iterates over files and walkDirs only iterates over directories.
    Added a synchronous HttpClient in the httpclient (doc) module. The old get, post and similar procedures are now deprecated in favour of it.
    Added a new macro called multisync allowing you to write procedures for synchronous and asynchronous sockets with no duplication.
    The async macro will now complete FutureVar[T] parameters automatically unless they have been completed already.

Tool Additions

    The documentation is now searchable and sortable by type.
    Pragmas are now hidden by default in the documentation to reduce noise.
    Edit links are now present in the documentation.

Compiler Additions

    The -d/--define flag can now optionally take a value to be used by code at compile time. (doc)

Nimscript Additions

    It's possible to enable and disable specific hints and warnings in Nimscript via the warning and hint procedures.
    Nimscript exports a proc named patchFile which can be used to patch modules or include files for different Nimble packages, including the stdlib package.

Language Additions

    Added {.intdefine.} and {.strdefine.} macros to make use of (optional) compile time defines. (doc)
    If the first statement is an import system statement then system is not imported implicitly anymore. This allows for code like import system except echo or from system import nil.

Bugfixes

The list below has been generated based on the commits in Nim's git repository. As such it lists only the issues which have been closed via a commit, for a full list see this link on Github.

    Fixed "RFC: should startsWith and endsWith work with characters?" (#4252)
    Fixed "Feature request: unbuffered I/O" (#2146)
    Fixed "clear() not implemented for CountTableRef" (#4325)
    Fixed "Cannot close file opened async" (#4334)
    Fixed "Feature Request: IDNA support" (#3045)
    Fixed "Async: wrong behavior of boolean operations on futures" (#4333)
    Fixed "os.walkFiles yields directories" (#4280)
    Fixed "Fix #4392 and progress on #4170" (#4393)
    Fixed "Await unable to wait futures from objects fields" (#4390)
    Fixed "TMP variable name generation should be more stable" (#4364)
    Fixed "nativesockets doesn't compile for Android 4.x (API v19 or older) because of gethostbyaddr" (#4376)
    Fixed "no generic parameters allowed for ref" (#4395)
    Fixed "split proc in strutils inconsistent for set[char]" (#4305)
    Fixed "Problem with sets in devel" (#4412)
    Fixed "Compiler crash when using seq[PNimrodNode] in macros" (#537)
    Fixed "ospaths should be marked for nimscript use only" (#4249)
    Fixed "Repeated deepCopy() on a recursive data structure eventually crashes" (#4340)
    Fixed "Analyzing destructor" (#4371)
    Fixed "getType does not work anymore on a typedesc" (#4462)
    Fixed "Error in rendering empty JSON array" (#4399)
    Fixed "Segmentation fault when using async pragma on generic procs" (#2377)
    Fixed "Forwarding does not work for generics, | produces an implicit generic" (#3055)
    Fixed "Inside a macro, the length of the seq data inside a queue does not increase and crashes" (#4422)
    Fixed "compiler sigsegv while processing varargs" (#4475)
    Fixed "JS codegen - strings are assigned by reference" (#4471)
    Fixed "when statement doesn't verify syntax" (#4301)
    Fixed ".this pragma doesn't work with .async procs" (#4358)
    Fixed "type foo = range(...) crashes compiler" (#4429)
    Fixed "Compiler crash" (#2730)
    Fixed "Crash in compiler with static[int]" (#3706)
    Fixed "Bad error message "could not resolve"" (#3548)
    Fixed "Roof operator on string in template crashes compiler (Error: unhandled exception: sons is not accessible [FieldError])" (#3545)
    Fixed "SIGSEGV during compilation with parallel block" (#2758)
    Fixed "Codegen error with template and implicit dereference" (#4478)
    Fixed "@ in importcpp should work with no-argument functions" (#4496)
    Fixed "Regression: findExe raises" (#4497)
    Fixed "Linking error - repeated symbols when splitting into modules" (#4485)
    Fixed "Error: method is not a base" (#4428)
    Fixed "Casting from function returning a tuple fails" (#4345)
    Fixed "clang error with default nil parameter" (#4328)
    Fixed "internal compiler error: openArrayLoc" (#888)
    Fixed "Can't forward declare async procs" (#1970)
    Fixed "unittest.check and sequtils.allIt do not work together" (#4494)
    Fixed "httpclient package can't make SSL requests over an HTTP proxy" (#4520)
    Fixed "False positive warning "declared but not used" for enums." (#4510)
    Fixed "Explicit conversions not using converters" (#4432)
    Fixed "Unclear error message when importing" (#4541)
    Fixed "Change console encoding to UTF-8 by default" (#4417)
    Fixed "Typedesc ~= Generic notation does not work anymore!" (#4534)
    Fixed "unittest broken?" (#4555)
    Fixed "Operator "or" in converter types seems to crash the compiler." (#4537)
    Fixed "nimscript failed to compile/run -- Error: cannot 'importc' variable at compile time" (#4561)
    Fixed "Regression: identifier expected, but found ..." (#4564)
    Fixed "varargs with transformation that takes var argument creates invalid c code" (#4545)
    Fixed "Type mismatch when using empty tuple as generic parameter" (#4550)
    Fixed "strscans" (#4562)
    Fixed "getTypeImpl crashes (SIGSEGV) on variant types" (#4526)
    Fixed "Wrong result of sort in VM" (#4065)
    Fixed "I can't call the random[T](x: Slice[T]): T" (#4353)
    Fixed "invalid C code generated (function + block + empty tuple)" (#4505)
    Fixed "performance issue: const Table make a copy at runtime lookup." (#4354)
    Fixed "Compiler issue: libraries without absolute paths cannot be found correctly" (#4568)
    Fixed "Cannot use math.`^` with non-int types." (#4574)
    Fixed "C codegen fails when constructing an array using an object constructor." (#4582)
    Fixed "Visual Studio 10 unresolved external symbol _trunc(should we support VS2010?)" (#4532)
    Fixed "Cannot pass generic subtypes to proc for generic supertype" (#4528)
    Fixed "Lamda-lifting bug leading to crash." (#4551)
    Fixed "First-class iterators declared as inline are compiled at Nim side (no error message) and fail at C" (#2094)
    Fixed "VS2010-warning C4090 : 'function' : different 'const' qualifiers" (#4590)
    Fixed "Regression: type mismatch with generics" (#4589)
    Fixed "„can raise an unlisted exception“ when assigning nil as default value" (#4593)
    Fixed "upcoming asyncdispatch.closeSocket is not GC-safe" (#4606)
    Fixed "Visual Studio 10.0 compiler errors, 12.0 warning" (#4459)
    Fixed "Exception of net.newContext: result.extraInternalIndex == 0 [AssertionError]" (#4406)
    Fixed "error: redeclaration of 'result_115076' with no linkage" (#3221)
    Fixed "Compiler crashes on conversion from int to float at compile time" (#4619)
    Fixed "wrong number of arguments regression in devel" (#4600)
    Fixed "importc $ has broken error message (and is not documented)" (#4579)
    Fixed "Compiler segfaults on simple importcpp in js mode [regression]" (#4632)
    Fixed "Critical reference counting codegen problem" (#4653)
    Fixed "tables.nim needs lots of {.noSideEffect.}" (#4254)
    Fixed "Capture variable error when using => macro" (#4658)
    Fixed "Enum from char: internal error getInt" (#3606)
    Fixed "Compiler crashes in debug mode (no error in release mode) with Natural discriminant in object variants" (#2865)
    Fixed "SIGSEGV when access field in const object variants" (#4253)
    Fixed "varargs cannot be used with template converter." (#4292)
    Fixed "Compiler crashes when borrowing $" (#3928)
    Fixed "internal error: genMagicExpr: mArrPut" (#4491)
    Fixed "Unhelpful error message on importc namespace collision" (#4580)
    Fixed "Problem with openarrays and slices" (#4179)
    Fixed "Removing lines from end of file then rebuilding does not rebuild [js only?]" (#4656)
    Fixed "getCurrentException and getCurrentExceptionMsg do not work with JS" (#4635)
    Fixed "generic proc parameter is not inferred if type parameter has specifier" (#4672)
    Fixed "Cannot instantiate generic parameter when it is parent type parameter" (#4673)
    Fixed "deepCopy doesn't work with inheritance after last commit" (#4693)
    Fixed "Multi-methods don't work when passing ref to a different thread" (#4689)
    Fixed "Infinite loop in effect analysis on generics" (#4677)
    Fixed "SIGSEGV when compiling NimYAML tests" (#4699)
    Fixed "Closing AsyncEvent now also unregisters it on non-Windows platforms" (#4694)
    Fixed "Don't update handle in upcoming/asyncdispatch poll() if it was closed" (#4697)
    Fixed "generated local variables declared outside block" (#4721)
    Fixed "Footer Documentation links, & Community link point to the wrong place under news entries" (#4529)
    Fixed "Jester's macro magic leads to incorrect C generation" (#4088)
    Fixed "cas bug in atomics.nim" (#3279)
    Fixed "nimgrep PEG not capturing the pattern 'A'" (#4751)
    Fixed "GC assert triggers when assigning TableRef threadvar" (#4640)
    Fixed ".this pragma conflicts with experimental ptr dereferencing when names conflict" (#4671)
    Fixed "Generic procs accepting var .importcpp type do not work [regression]" (#4625)
    Fixed "C Error on tuple assignment with array" (#4626)
    Fixed "module securehash not gcsafe" (#4760)
    Fixed "Nimble installation failed on Windows x86." (#4764)
    Fixed "Recent changes to marshal module break old marshalled data" (#4779)
    Fixed "tnewasyncudp.nim test loops forever" (#4777)
    Fixed "Wrong poll timeout behavior in asyncdispatch" (#4262)
    Fixed "Standalone await shouldn't read future" (#4170)
    Fixed "Regression: httpclient fails to compile without -d:ssl" (#4797)
    Fixed "C Error on declaring array of heritable objects with bitfields" (#3567)
    Fixed "Corruption when using Channels and Threads" (#4776)
    Fixed "Sometimes Channel tryRecv() erroneously reports no messages available on the first call on Windows" (#4746)
    Fixed "Improve error message of functions called without parenthesis" (#4813)
    Fixed "Docgen doesn't find doc comments in macro generated procs" (#4803)
    Fixed "asynchttpserver may consume unbounded memory reading headers" (#3847)
    Fixed "TLS connection to api.clashofclans.com hangs forever." (#4587)
2017-02-05 01:27:30 +00:00
kamil
3a53ccf1b9 Import nim-0.14.2 as lang/nim
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 a soft realtime
GC on thread local heaps. Asynchronous message passing is used between
threads, so no "stop the world" mechanism is necessary. An unsafe shared
memory heap is also provided for the increased efficiency that results from
that model.

Originally packaged in pkgsrc-wip by:
 - Christian Koch
 - Roland Illig
and
 - myself.
2016-09-18 01:02:43 +00:00