Nimrod是一個編譯型的具有垃圾收集的系統程式語言,有著極其卓越的生產/效能比。Nimrod的設計集中在三個E上:即效率(efficiency)、表達能力(expressiveness)和優雅(elegance)。
Nim 0.10.2 釋出,此版本包括大量的語言改進,一些可能會跟現有的程式碼大不相同。為了大家的方便,新增了一個新的工具 nimfix,使用最新版本的編譯器,幫助轉換現有的專案。
Nim 很快就要開始 1.0 版本了,1.0 版本將不會有太多重大的改進。現階段新增了新的模組 asyncdispatch,幫助便攜高效的 web 伺服器應用,使用非阻塞程式碼。Nim 新增了一個內建執行緒池,為了使用 spawn 進行輕量級的執行緒開發。
此版本廢棄了T "T" 和 "P" 型別字首,新增了一個新的可搜尋的論壇,新增了新的網站和改進現有的文件生成器 docgen。
Nim 將會很快到達 1.0 版本,除了 bug 修復,計劃新增兩個重要特性:
- static [T] needs to be defined precisely and the bugs in the implementation need to be fixed.
- Overloading of the assignment operator is required for some generic containers and needs to be implemented.
更新日誌
影響向後相容方面的改進
- The language has been renamed from Nimrod to Nim. The name of the compiler changed from nimrod to nim too.
- system.fileHandle has been renamed to system.getFileHandle to prevent name conflicts with the new type FileHandle.
- Comments are now not part of the AST anymore, as such you cannot use them in place ofdiscard.
- Large parts of the stdlib got rid of the T/P type prefixes. Instead most types now simply start with an uppercased letter. The so called "partial case sensitivity" rule is now active allowing for code like var foo: Foo in more contexts.
- String case (or any non-ordinal case) statements without 'else' are deprecated.
- Recursive tuple types are not allowed anymore. Use object instead.
- The PEGS module returns nil instead of "" when an optional capture fails to match.
- The re module returns nil instead of "" when an optional capture fails to match.
- The "symmetric set difference" operator (-+-) never worked and has been removed.
- defer is a keyword now.
- func is a keyword now.
- The using language feature now needs to be activated via the new {.experimental.} pragma that enables experimental language features.
- Destructors are now officially experimental.
- Standalone except and finally statements are deprecated now. The standalone finally can be replaced with defer, standalone except requires an explicit try.
- Operators ending in > are considered as "arrow like" and have their own priority level and are right associative. This means that the => and -> operators from the future module work better.
- Field names in tuples are now ignored for type comparisons. This allows for greater interoperability between different modules.
- Statement lists are not converted to an implicit do block anymore. This means the confusingnnkDo nodes when working with macros are gone for good.
語言元件
- The new concurrency model has been implemented including locks sections, lock levels and object field guards.
- The parallel statement has been implemented.
- deepCopy has been added to the language.
- The builtin procCall can be used to get super-like functionality for multi methods.
- There is a new pragma {.experimental.} that enables experimental language features per module, or you can enable this features on a global level with the --experimental command line option.
編譯器元件
- The compiler now supports mixed Objective C / C++ / C code generation: The modules that use importCpp or importObjc are compiled to C++ or Objective C code, any other module is compiled to C code. This improves interoperability.
- There is a new parallel statement for safe fork&join parallel computing.
- guard and lock pragmas have been implemented to support safer concurrent programming.
- The following procs are now available at compile-time:
- Two backticks now produce a single backtick within an emit or asm statement.
- There is a new tool, nimfix to help you in updating your code from Nimrod to Nim.
- The compiler's output has been prettified.
庫元件
- Added module fenv to control the handling of floating-point rounding and exceptions (overflow, division by zero, etc.).
- system.setupForeignThreadGc can be used for better interaction with foreign libraries that create threads and run a Nim callback from these foreign threads.
- List comprehensions have been implemented as a macro in the future module.
- The new Async module (asyncnet) now supports SSL.
- The smtp module now has an async implementation.
- Added module asyncfile which implements asynchronous file reading and writing.
- osproc.kill has been added.
- asyncnet and asynchttpserver now support SO_REUSEADDR.
Bug 修復
- nil and NULL are now preserved between Nim and databases in the db_* modules.
- Fixed issue with OS module in non-unicode mode on Windows.
- Fixed issue with x.low (#1366).
- Fixed tuple unpacking issue inside closure iterators (#1067).
- Fixed ENDB compilation issues.
- Many asynchttpserver fixes.
- Macros can now keep global state across macro calls (#903).
- osproc fixes on Windows.
- osproc.terminate fixed.
- Improvements to exception handling in async procedures. (#1487).
- try now works at compile-time.
- Fixes T = ref T to be an illegal recursive type.
- Self imports are now disallowed.
- Improved effect inference.
- Fixes for the math module on Windows.
- User defined pragmas will now work for generics that have been instantiated in different modules.
- Fixed queue exhaustion bug.
- Many, many more.
更多內容請看發行說明。
相關連結
來自:開源中國社群
相關閱讀
評論(1)