设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客

Nim 0.10.2发布,命令式编程语言

2014-12-30 16:32| 发布者: joejoe0332| 查看: 2338| 评论: 0|原作者: oschina|来自: oschina

摘要:   Nimrod (已改名为 Nim)是一个新型的静态类型、命令式编程语言,支持过程式、函数式、面向对象和泛型编程风格而保持简单和高效。Nimrod从Lisp继承来的一个特殊 特性--抽象语法树(AST)作为语言规范的一部分,可以 ...

  Nimrod (已改名为 Nim)是一个新型的静态类型、命令式编程语言,支持过程式、函数式、面向对象和泛型编程风格而保持简单和高效。Nimrod从Lisp继承来的一个特殊 特性--抽象语法树(AST)作为语言规范的一部分,可以用作创建领域特定语言的强大宏系统。


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

  • 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 confusing nnkDo 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:

    math.sqrt, math.ln, math.log10, math.log2, math.exp, math.round,
    math.arccos, math.arcsin, math.arctan, math.arctan2, math.cos, math.cosh,
    math.hypot, math.sinh, math.sin, math.tan, math.tanh, math.pow,
    math.trunc, math.floor, math.ceil, math.fmod,
    os.getEnv, os.existsEnv, os.dirExists, os.fileExists,
    system.writeFile
  • 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.

更多内容请看发行说明

酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部