
Linuxeden 开源社区 --
Nim 0.17.0 发布了,Nim 是一种专注于性能,可移植性和表现力的系统编程语言。
此版本修复了 0.16.0 版本中最重要的回归,特别是内存管理器和通道错误已经修复。
语言方面也有很多重大改进,特别是在概念(concepts)方面投入大量的工作。请查看下面的更改日志,获取全面的更改列表。
影响向后兼容性的变更:
- There are now two different HTTP response types,
ResponseandAsyncResponse.AsyncResponse’sbodyaccessor returns aFuture[string]!Due to this change you may need to add another
awaitin your code. httpclient.requestnow respects themaxRedirectsoption. Previously redirects were handled only bygetandpostprocs.- The IO routines now raise
EOFErrorfor the “end of file” condition.EOFErroris a subtype ofIOErrorand so it’s easier to distinguish between “error during read” and “error due to EOF”. - A hash procedure has been added for
cstringtype inhashesmodule. Previously, hash of acstringwould be calculated as a hash of the pointer. Now the hash is calculated from the contents of the string, assumingcstringis a null-terminated string. Equalstringandcstringvalues produce an equal hash value. - Macros accepting
varargsarguments will now receive a node having thenkArgListnode kind. Previous code expecting the node kind to benkBracketmay have to be updated. memfiles.opennow closes file handles/fds by default. PassingallowRemap=truetomemfiles.openrecovers the old behavior. The old behavior is only needed to callmapMemon the resultingMemFile.posix.nim: For better C++ interop the fieldsa_sigaction*: proc (x: cint, y: var SigInfo, z: pointer) {.noconv.}was changed tosa_sigaction*: proc (x: cint, y: ptr SigInfo, z: pointer) {.noconv.}.- The compiler doesn’t infer effects for
.basemethods anymore. This means you need to annotate them with.gcsafeor similar to clearly declare upfront every implementation needs to fullfill these contracts. system.getAst templateCall(x, y)now typechecks thetemplateCallproperly. You need to patch your code accordingly.macros.getTypeandmacros.getTypeImplfor 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 repeatedEnumTynode and was missing the initial pragma node (which is currently empty for an enum).macros.getTypeImplnow correctly returns the implementation for a symbol of typetyGenericBody.- If the dispatcher parameter’s value used in multi method is
nil, aNilErrorexception is raised. The old behavior was that the method would be anopthen. posix.nim: the family ofntohsprocs 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
requiresInitpragma 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,execCmdwill return 128 + signal number if the application terminates via signal. ospaths.getConfigDirnow conforms to the XDG Base Directory specification on non-Windows OSs. It returns the value of theXDG_CONFIG_DIRenvironment variable if it is set, and returns the default configuration directory, “~/.config/”, otherwise.- Renamed the line info node parameter for
newNimNodeprocedure. - The parsing rules of
dochanged.foo bar do: bazUsed to be parsed as:
foo(bar(do: baz))Now it is parsed as:
foo(bar, do: baz)
详情请参阅 发布主页 。
下载地址
转自 http://ift.tt/2qYzqgM
The post Nim 0.17.0 发布,命令式编程语言 appeared first on Linuxeden开源社区.
http://ift.tt/2ryT93A
没有评论:
发表评论