Nim version 1.6 is now officially released!
The Nim team is happy to announce version 1.4.8, our fourth patch release for Nim 1.4.
The Nim team is happy to announce the double patch release of versions 1.2.12 and 1.4.6.
The Nim team is happy to announce the double patch release of versions 1.2.10 and 1.4.4.
The Nim community survey 2020 has been open for one month, and we have received 769 responses - we think this is a large enough sample to draw conclusions about our users and their habits. Before we go into details, we would like to thank all the people who took the time to respond. We really appreciate the feedback!
A lot has happened in the Nim world in 2020: two new major releases, two new memory managements strategies (ARC and ORC), the first Nim conference, and much more.
We are proud to announce the launch of the official 2020 Nim Community Survey!
The Nim team is happy to announce version 1.4.2, our first patch release for Nim 1.4.
Tuesday December 1st at 5 a.m. UTC will mark the start of the sixth incarnation of Advent of Code, popular programming contest started back in 2015. The author describes Advent of Code (AoC) as “a series of small programming puzzles for a variety of skill sets and skill levels in any programming language you like”.
The Nim team is happy to announce this double release of versions 1.2.8 and 1.0.10.
我们非常自豪地宣布,经过六个月的持续开发,Nim 1.4 版本已经发布了! 除了 1.0 版本之外,这可能是迄今为止最大的 Nim 版本,我们很高兴能够发布它。
Hacktoberfest is an annual event happening in October which celebrates open source software and encourages meaningful contributions to the open source ecosystem. To win a T-shirt or plant a tree, you must sign up on the Hacktoberfest site and make four pull requests to any repo on Github by the end of October.
7 years ago I wrote how Nim would get “write
tracking”
as an alternative to adding const
to Nim’s type system.
This year it finally made it into Nim nightly!
Since then the feature was reimplemented and all the details how it works did change.
The Nim team is happy to announce this double release of versions 1.2.6 and 1.0.8.
NimConf is happening on Saturday June 20th 2020, don’t miss it!
The Nim team is happy to announce version 1.2.2, our first patch release for Nim 1.2.
Mark the date: Saturday, June 20th 2020.
Nim 团队很高兴为大家带来 1.0.6 版本发布的消息!这是我们在 Nim 1.0.0 之后带来的第三个补丁。
想了解更多关于 1.0.0 版本的信息,可以查阅 v1.0 发布说明.
本次的版本发布于前一个版本发布两个月之后, 包含了将近 60 次提交, 新修复了 15 个已知的错误、一些其他的 bug 修复、和文档优化, 这些都让我们的 1.0 发行版变得更好。
没有安全性相关的问题,但我们正努力保证每两个月发布一个新 1.0.x 版本的稳定周期。
如果你已经使用 choosenim
安装了之前版本的 Nim ,升级到 1.0.6 版本会非常简单:
$ choosenim update stable
如果没有的话,你可以通过
这些教程来安装 choosenim
,
当然你也可以根据网站 安装页 的说明直接安装 Nim 。
nim doc
错误地处理导出局部符号 (export localSymbol
) 的问题”
(#13100)buildIndex
使用 -o
选项 (#13037)我们骄傲地宣布: 2019Nim中文社区问卷 启动! 无论你当前正在使用 Nim ,还是之前用过 Nim ,或者从未使用过 Nim ; 我们都想要听听你的观点。
由于官方使用的是国内无法访问的 Google Form,我们对官方问卷做了本地化,进行了翻译并加入了更符合国内环境的选项。
我们会在问卷结束后将结果反馈给官方,所以你的反馈将会帮助 Nim 项目了解到它的长处和不足, 并确定未来的开发优先级。而且会指导中文社区明年的发展重点和方向。
完成这个问卷应该会占用你五分钟的时间。 2020 年 2 月之前你可以随时提交。 (由于“新冠”肺炎疫情的影响,我们取消了问卷的时间限制,但也请尽快完成,我们仍然可能会在不久的将来增加时间限制。) 如果你有任何的问题及反馈,请不要吝于告诉我们:
发邮件给我们 [email protected] , 或者在 Nim 论坛 中发言。
这已经是 Nim 官方举办社区问卷的第四个年头了。 你可以通过下面的链接查看过去几年的统计结果:
我们也恳请并感谢您将这份问卷传播给其他人。 你可以在你的社交帐号上,和你的同事、朋友和其他社区分享这份 MicroSoft Forms 的链接。
感谢您的参与!
我们骄傲地宣布:官方 2019 Nim 社区问卷 启动! 无论你当前正在使用 Nim ,还是之前用过 Nim ,或者从未使用过 Nim ; 我们都想要听听你的观点。 你的反馈将会帮助 Nim 项目了解到它的长处和不足, 并确定未来的开发优先级。
Nim 团队很高兴公布 v1.0.2 版本, 这是在 1.0.0 之后我们首次发布补丁。
Windows下 nim v0.20 版本安装,无法运行 finish.exe 的解决方案
Nim is a statically typed compiled systems programming language.
It combines successful concepts from mature languages like Python,Ada and Modula.
Nim是一种静态类型编译的系统编程语言。
它结合了来自成熟语言(如Python、Ada和Modula)的成功概念。
Nim中文网站:https://nim-lang-cn.org/
下载页:https://nim-lang-cn.org/install.html
进入上方官方网站, 并根据你使用的操作系统, 下载最新的稳定版压缩包
解压到任意你喜欢的目录下
运行此目录下的finish.exe
根据提示进行环境变量的配置
根据提示进行MingW的下载和解压, 并配置目录下的bin目录到环境变量中, 所以无需解压到nim目录下
在finish.exe引导安装完成之后 (建议先重启电脑,防止环境变量不生效) , 打开一个命令行, 并输入:nim命令进行测试。 如果能够显示如下图像, 就说明安装成功了。
但在0.20版本安装的过程中,出现了finish.exe无法运行的情况,点击之后没有反应,后来终于找到了解决方案,并亲测有效。
在finish.exe同级目录下, 按住Shift键,同时右击文件夹的空白处, 选择在此处打开Poweshell(或者cmd)
输入并运行.\finish.exe
正常来说,有问题的话这里会直接抛出异常,并打印出错误原因; 没问题的话,这里会直接正常运行finish.exe
然后就可以根据报错,去查找答案了。
Error: unhandled exception: file 'C:\user\xxx\.nimble\bin' does not exist [OSError]
https://github.com/nim-lang/Nim/issues/11676#issuecomment-510780848 (这条回复我写的,欢迎follow我~)
怀疑可能是因为finish.exe
没有权限在【我的文档
】
(姑且按Win7这么叫,
毕竟win8以后是用户名了,
其实正经应该叫%User Home%
,
但是不知道该怎么翻译……)
中创建目录导致的。
手动在%User Home%
中创建.nimble/
目录,然后再试试在命令行中运行finish.exe
,还不行就把.nimble/
下的bin/
也创建了。
我的是在把这两个都创建了之后就好了。
目前没有碰到其他问题, 如果有朋友遇到了其他问题的话, 欢迎来我的博客下面留言, 让我们一起帮助Nim快速成长(到1.0版本)!
Nim中文官网现已上线! 大家可以通过https://nim-lang-cn.org来访问。
官网是我们的起点, 它不只是一个官网的中文镜像, 我们更希望它是一个国内Nim圈子的基地, 一个核心。 所有的资源都会围绕这个核心, 所以我们会认真地打磨它:
我们会及时更新和翻译官网的博客和其他更新, 以便大家掌握第一手的Nim资讯
我们会及时将国内的Nim资源整合起来, 让官网可以真正运行起来, 发挥它的作用, 走出一条中国特色的Nim发展道路。
当你需要教程和资料时, 我们希望你第一个想到的是去官网上找, 并且我们会尽全力让你能够在官网上找到你需要的一切。
我们也会在官网上建立论坛上的优秀资源的索引, 定期更新及时、优质的论坛资源, 并推送到思否、CSDN、OSChina、微博等主流媒体上。
我们的初衷是想要建立起国内的Nim开发者生态。
以官网为核心, 让Nim开发者们把注意力集中到这里:
官网上有很多论坛的索引,有问题可以去论坛问,便于存档;
官网上也尽量多地整理了QQ、微信群, 有紧急的问题可以去聊天工具上问,能够及时得到回复;
也可以通过学习页面上的【社区资源】模块, 获取到国内主流媒体上先行者的问题、解答或者一些心得体会的博文;
也可能会有线下的交流见面会,或者论坛、QQ群、微信群的一些活动, 让我们的社区有爱又团结,发挥出社区的力量。
而这些都可以从社区中查看, 我们也会将活动进行博客的推送, 你可以订阅RSS以及时获取这些令人振奋的消息。
目前官网中最关键的——文档,还没有能够完全翻译完, 学习和文档两个模块中的中文文档还在由@sheldon紧锣密鼓地翻译中, 但是大家都是通过业余时间以非盈利的方式参与进来的, 难免工作之余精力优先, 所以也欢迎大家加入我们来贡献自己的力量。
我们也欢迎你把自己的Nim博客推荐给我们! 我们欢迎各种方向,各种优质、高产的Nim博客, 我们会在学习页面的社区资源栏将你的博客挂上, 供大家学习。
new runtimes完成之日,就是Nim 1.0发布之时!
特别感谢@sheldon大佬的鼎力支持 和Nim开发集中营各位的帮助。
感谢大家的支持和等待,让我们一起创造Nim中文社区的繁荣,推动Nim的发展。
Nim团队很荣幸为大家带来0.20.2版本,这是我们为1.0版本准备的第二个RC版本。
请点击之前的版本发布日志 以查看更多关于0.20版本的信息,以及我们关于1.0及之后版本的计划。 此版本主要包含了对0.20.0(1.0 RC1)版本的BUG修复。
唯一的新功能是我们添加了名为toOpenArray
的切片操作符,
现对JavaScript后端可用。
这次更新距离上一个版本的发布尽管只差了一个月, 但它却包含了超过200次的新commit,修复了超过70个被提出来的issues, 并且带来了很多应该能让Nim更加稳定的改进。
在0.20.0版本发布后,我们改进了我们的代码样式检查器,
现在可以通过在启动Nim时加上--styleCheck:error
标识,
这意味着可以对编译器和标准库进行代码风格检查了,
如果使用了不同的代码风格(比如:fooBar
和foo_bar
),那么这些代码将不会被编译。
我们对于这个版本的关注点还有一个,那就是我们的nimpretty
工具:
这是一个Nim的源码美化器,
用来把代码格式化得符合官方风格(NEP-1)。
我们进行了超过30个提交,以改善nimpretty
体验,让它更有能力应对现实场景。
新的runtime进展很顺利,但它还没有达到预想的状态,
所以他在1.0版本中将作为一个可选的特性。
下一个重要的里程碑是使新的运行时与async
一起工作。
只有完成这一点,我们才会真正地进行推广,让大家优先考虑它。
你之前如果已经使用choosenim
来安装了旧版本的Nim,
那么更新到0.20.2版本将会非常的简单:
$ choosenim update stable
如果你之前并没有使用它,你可以通过
这篇介绍来获取choosenim
。
当然你也可以直接根据我们的安装页面,
单独安装Nim。
(译者注:在Windows下的choosenim只支持32位的下载, 你可以在64位系统下进行安装,但是这样的话你的nim版本只能也使用32位的,否则会报错)
All strutils.rfind
procs now take start
and last
like strutils.find
with the same data slice/index meaning. This is backwards compatible for
calls not changing the rfind
start
parameter from its default. (#11487)
In the unlikely case that you were using rfind X, start=N
, or rfind X, N
,
then you need to change that to rfind X, last=N
or rfind X, 0, N
. (This
should minimize gotchas porting code from other languages like Python or C++.)
On Windows stderr/stdout/stdin are not opened as binary files anymore. Use the switch
-d:nimBinaryStdFiles
for a transition period.
uint8
type, so type
conversions like x.sin_family = uint16 toInt(nativesockets.AF_INET)
need to be changed into x.sin_family = TSa_Family toInt(nativesockets.AF_INET)
.toOpenArray
现已可用。Fix async IO operations stalling even after socket is closed. (#11232)
More informative error message for streams.openFileStream
. (#11438)
Better error message for IndexError for empty containers. (#11476)
Fix regression in semfold for old right shift. (#11477)
Fix for passing tuples as static params to macros. (#11423)
;
, {
etc”
(#10159)result
”
(#11525)field=
”
(#11514)-d:release
) output contains toolchain path on dev’s machine”
(#11545)finally
block executed twice in VM”
(#11610)$
]” calls $
n^2 times instead of n times (n=len(varargs))”
(#8316)continue
in an except Exception as e
block crashes the compiler.”
(#11683)The Nim team is happy to announce that the latest release of Nim, version 0.19.6, is now available. Nim is a systems programming language that focuses on performance, portability and expressiveness.
This is the third bugfix release of version 0.19. There are no breaking changes. The most important bugfixes are:
If you have installed a previous version of Nim using choosenim
,
getting Nim 0.19.6 is as easy as:
$ choosenim update stable
If you don’t have it already, you can get choosenim
by following
these instructions or you can install
Nim by following the instructions on our
install page.
The Nim team is happy to announce that the latest release of Nim, version 0.19.4, is now available. Nim is a systems programming language that focuses on performance, portability and expressiveness.
This is mostly a bugfix release of version 0.19.2. There are no breaking changes. The most important bugfixes are:
koch tests
.async
procs was missing, fixed.If you have installed a previous version of Nim using choosenim
,
getting Nim 0.19.4 is as easy as:
$ choosenim update stable
If you don’t have it already, you can get choosenim
by following
these instructions or you can install
Nim by following the instructions on our
install page.
import
inside block
: makes N runnableExamples run N x faster, minimizes scope pollution”
(#9300)Error: unhandled exception: cannot open: /Users/travis/.cache/nim/docgen_sample_d/runnableExamples/docgen_sample_examples.nim [IOError]
”
(#10188)..\..\..\..\..\
prefix since 0.19.0”
(#9556)There were several big news in the Nim world in 2018 – two new major releases, partnership with Status, and much more. But let us go chronologically.
The first week of February is reserved for FOSDEM, where members of Nim core development team were promoting the newly published book Nim in Action, selling Nim T-shirts, and meeting with Nim developers.
In March 2018, version 0.18 has been released. With more than 1300 commits since the previous version, it was the biggest release of Nim so far.
It introduced strformat
module with fmt
and &
operators for formatted string literals, the ability to have testable documentation examples with runnableExamples
, and numerous async
improvements.
The TLSF algorithm has been implemented to reduce memory fragmentation, which made alloc
and dealloc
O(1) operations.
In August the partnership with Status was announced.
The Status team has chosen the Nim programming language as a base for the implementation of a sharding client for Ethereum, named Nimbus. With this partnership Status will support the Nim team with funding and resources needed to stay focused on the development of the Nim programming language.
This allowed hiring two full-time developers, tasked with fixing bugs, responding to issues, and developing the compiler, the standard library and the tooling.
Version 0.19, released in September, took the crown from 0.18 as the biggest release yet, with more than 1400 new commits.
The biggest change introduced is that the nil
state for strings and sequences is gone – the default value for these are ""
and @[]
(an empty string, and an empty sequence, respectively).
This eliminates a major confusion-point for beginners, and makes Nim more pleasant for everybody.
This version introduced experimental
as a pragma and a command line switch that can enable specific language extensions (it is not an all-or-nothing switch, like before).
Other notable additions include func
as an alias for a procedure with no side effects, supporting except
in the export
statement, so called “for-loop macros”, async
working with exception handling (now it is possible to use await
in a try
statement), and more.
In October our community participated in Hacktoberfest, resulting in impressive 275 closed issues and 160 merged pull requests – more detailed documentation, improved tests, general cleanup, and much more. These improvements will be part of 0.20 release, and some of them are already backported to the latest bugfix release – 0.19.2.
If you’re interested in seeing and hearing what has been done in 2018 directly from the core developers, take a look at Nim Development Blog 2018 on Youtube.
We have switched to a different release model, with a stable branch (currently that’s v0.19.x) which receives bugfixes, it is aimed at daily usage, and Nimble package development should target this version; and a devel branch which will become a new major release – v0.20, and serve as a release candidate for v1.0.
In 2019, the Nim team will continue to work towards that goal, which will mark the end of breaking changes to Nim. We are focusing on the main areas shown in Nim community survey 2018 as needed before Nim v1.0:
Community help is, as always, welcome. Report issues and bugs, make pull requests, consider donating or becoming a sponsor.
The Nim team is happy to announce that the latest release of Nim, version 0.19.2, is now available. Nim is a systems programming language that focuses on performance, portability and expressiveness.
This is mostly a bugfix release of version 0.19.0. It adds RISC-V support and there are no breaking changes. The most important bugfixes are:
spawn
can handle the empty seqs/strings that are internally
represented as nil
.If you have installed a previous version of Nim using choosenim
,
getting Nim 0.19.2 is as easy as:
$ choosenim update stable
If you don’t have it already, you can get choosenim
by following
these instructions or you can install
Nim by following the instructions on our
install page.
\\
at the end of a path in copyDir
removes every file’s first char”
(#9126)runnableExamples
should be run by nim doc
even if symbol is not public”
(#9216)config.nims
not being read anymore”
(#9264)nim js -o:dirname main.nim
writes nothing, and no error shown”
(#9154)Source
links point to master instead of devel”
(#9295)seq
)”
(#2361)Fixed “tfragment_gc test is flaky on OSX” (#9421)
lines
to closure iterator, most likely caused by defer”
(#5321)Fixed “old changelogs should be kept instead of erased” (#9376)
nim doc strutils.nim
fails on 32 bit compiler with AssertionError on a RunnableExample”
(#9525)Fixed “using Selectors, Error: undeclared field: ‘OSErrorCode’” (#7667)
nim doc
”
(#9235)..\..\..\..\..\
prefix since 0.19.0”
(#9556)Fixed “Nim/compiler/pathutils.nim(226, 12) canon"/foo/../bar" == "/bar"
[AssertionError]” (#9507)
internal error: (filename: "vmgen.nim", line: 1119, column: 19)
”
(#9609)optInd
missing indent specification in grammar.txt”
(#9608)Saturday December 1st at 5 a.m. UTC will mark the start of the fourth incarnation of Advent of Code, popular programming contest started back in 2015. The author describes Advent of Code (AoC) as “a series of small programming puzzles for a variety of skill sets and skill levels in any programming language you like”.
The rules of AoC are quite simple. Starting from December 1st until Christmas, every day at 5 a.m. UTC a new task is released. The tasks consist of two parts, where second part is revealed after you solve the first part, and it is a continuation and/or variation of the first part. You don’t submit your code, just the result of your calculation.
The participation in AoC is free (although, if you like it, consider donating), all you need to do is log in with your Github, Google, Twitter, or Reddit account.
We are organizing the official Nim private leaderboard, where you can compete against other Nim users.
To join the Nim leaderboard, all you have to do is use 40415-c732e66e
code in the previous link.
The Nim team has decided to reward the best (fastest) player on Nim leaderboard, as well as the solutions which best showcase the power and capabilities of Nim language. Post a link to your AoC repository in this forum thread and share the solutions you’re most proud of, and maybe you’ll be one of the winners of “Nim in Action” book, Nim T-shirt, or stickers.
People usually share their solutions on r/adventofcode subreddit and we encourage you to share your Nim solutions there too.
If you have never participated in AoC before or you want to prepare yourself for the start of the competition by solving some tasks, take a look at the previous events.
We have recently closed the 2018 Nim Community Survey. I am happy to say that we have received exactly 771 responses, huge thanks to all the people that took the time to respond. We’re incredibly thankful for this very valuable feedback.
For the results of the previous year’s survey, take a look at the 2017 results analysis.
Our survey ran from the 23rd of June 2018 until the 31st of July 2018. The goal of this survey was primarily to determine how our community is using Nim, in order to better understand how we should be improving it. In particular, we wanted to know what people feel is missing from Nim in the lead up to version 1.0. We have also asked our respondents about how well the Nim tools worked, the challenges of adopting Nim, the resources that they used to learn Nim and more.
This article goes through some of the highlights in the results for the survey and discusses them in the context of the previous year’s results. The aim is to understand our users and to figure out priorities for Nim’s future.
This time around I have decided to publish the Google Survey results page, for some this may be more interesting than reading the highlights. It’s available here: https://i.imgur.com/g7slQ8w.png.
The questions in this survey were largely the same as last year’s, but there were some key changes. In particular, the following questions were added:
The following questions were removed:
The following questions were modified:
The “What critical libraries are missing in the Nim ecosystem?” and “What development tools, if any, can make you more productive when working with Nim?” questions were merged into “What features, tools, or libraries would you like Nim to have?”
We wanted to gain deeper knowledge of our contributor’s experiences, so a brand new section titled “Contributor questions” was introduced.
Like last year the respondents were split up into three groups:
This enabled each group to be targeted with specific questions. For example, ex-Nim users were asked why they’ve stopped using Nim.
This year the proportion of responses from current Nim users has grown from 43% to 47%. This is a slight increase in the proportion of Nim users answering the survey, but it’s important to note that the absolute number went up by over 100 users from last year.
This was a free-form question so there were many different answers, but a few answers were very common. By far the most common request was “version 1.0.”
Other honourable mentions include “more documentation”, “more stability” and “Free balloons”. These mostly align well with the general wishes of our community so you will see similar answers in later questions as well.
Visual Studio Code continues its dominance and has become even more dominant since the last survey. 51% of respondents selected Visual Studio Code, whereas only 35.5% selected it last year.
This questions gives a good idea about how popular Nim tools are and whether using them is enjoyable.
The most popular tool, as one might expect, is Nimble. The Nimble package manager also boasts a high like rating, with over 75% of respondents answering either “Like” or “Extreme Like” for Nimble.
The most unpopular tool is nimpretty, with 75% of respondents answering that they haven’t used it.
The most disliked tool is nimsuggest, although it is only disliked by 6% of the respondents.
Choosenim takes the crown as the most popular installation method, but only just barely. Other installation methods are also very popular.
The reasons given vary widely which makes their analysis challenging. In order to make it easier to see the reasons at a high level, I went through and grouped them into generic categories.
This offers some good insight into why programmers have stopped using Nim.
The number one reason is Nim’s relative lack of maturity, many respondents have quoted this as the reason why they have stopped using Nim. In most cases the respondents simply want 1.0 to be released. Together with maturity, multiple respondents also mentioned a general lack of libraries and Nim’s small ecosystem. These respondents were all counted under the “Maturity” category. The “Missing library” category mostly counts respondents who mentioned a specific library that was missing. This category could have easily been merged into the “Maturity” category but wasn’t for greater detail.
The second reason, categorised as “Not sufficiently better than other languages”, was mostly the respondent specifying that they are happy with another language, or that their project is more suited to another language.
Stability was the third reason. For this category, the respondents mostly talked about the stability of Nim as a whole. In many cases this meant tools such as IDEs not working properly rather than the compiler being buggy, although the latter was prevalent as well.
This is similar to the previous section, but it focuses on respondents who do not use Nim. As previously these vary widely so they have been put into categories.
Note that this is based on the long-form question which was asked in addition to the multiple choice question.
It seems that the number one reason why respondents are not using Nim is because they do not see the value in it. Many of the respondents didn’t see a reason why learning Nim was worthwhile. This is reflected in the number 1 category: “Not sufficiently better than other languages”.
Lack of time is of course a big factor too and in many cases it ties in with respondents not seeing value in learning Nim.
Nim’s relative immaturity was another strong theme among the responses.
An interesting number of respondents specified that they simply didn’t have a project, or couldn’t come up with a project to write in Nim. It may be worth exposing newcomers to some project ideas to alleviate this.
This question was asked last year to gauge how well we are informing users about where the Nim project is heading. In comparison to last year, the proportion of respondents answering “Yes” has increased to 25.8% from 23.5%. This is positive but we should do better, while it is an increase it is relatively minor. We should look into further ways to inform our community of our roadmap and other plans for the future.
This is a new question, it’s aim is to gauge the feeling in the community around whether a stable 1.0 release of Nim should have been made already.
Right now, the results are fairly even and thus it’s hard to know what to take away from them.
The chart above shows the general trends of what respondents felt was needed for Nim v1.0 to be released.
It was surprising to see so many respondents mentioning destructors, it seems that many people are excited about this feature and want it to be included in v1.0 of Nim.
The top three improvements though were, in order, “Better Docs”, “Stabilization” and finally “Better Stdlib”.
For the first one, respondents generally asked for more polished documentation but a significant portion of them also asked for video tutorials. Many felt that video tutorials were a good way to learn a programming language, we have already created some live streams where we coded Nim projects but it is obvious that we need to do more. In particular, we should:
For the second one, respondents generally asked for a more reliable experience with all language features. A reduction of compiler crashes and surprising behaviour was among the top wishes.
Finally for the “Better Stdlib” responses, many of them asked for a cleanup of the standard library. In particular the removal of deprecated functions but also the migration of some modules to a separate repository available via the Nimble package manager.
Thank you to each and every one of you who took the time to answer this survey. Your time is precious and we are deeply thankful that you used it to share your feedback.
Please remember that you do not need to wait for a survey in order to give us feedback, of course you’re more than welcome to wait if you wish, but ideally share your feedback with us immediately. We can be found in various different places, see the community page for links and instructions on how to get in touch: https://nim-lang.org/community.html.
If there are any questions about this survey I’m more than happy to answer them. Feel free to reach out to me on the community channels linked above.
Thanks for reading, and have a good day!
Hacktoberfest is an annual event happening in October which celebrates open source software and encourages meaningful contributions to the open source ecosystem.
To win a T-shirt, you must sign up on the Hacktoberfest site and make five pull requests to any repo on Github by the end of October. Even if you don’t manage to make five pull requests, you win Hacktoberfest stickers.
Nim would like to encourage you to participate in Hacktoberfest by contributing to the Nim repo or any other Nim-related repos.
Nim repo has more than 1400 open issues, which might be overwhelming to start. Here are some categories you might find interesting:
Poor documentation is often mentioned when people discuss Nim. Let’s make it better together!
Based on this research, the most used modules are: strutils, os, tables, math, sequtils, macros, times, unittest and json – improving these would be beneficial to most people, but feel free to choose any other Nim module.
For example, in the tables module what is missing is:
OrderedTable
and CountTable
,How to go about improving these?
Open the source file for tables module and you’ll see that the general documentation is at the top of the file, and to make an example, put it inside of a runnableExamples
block like this, which will make sure the code snippet stays valid:
proc addBar*(a: string): string =
## Adds "Bar" to ``a``.
runnableExamples:
doAssert "baz".addBar == "bazBar"
result = a & "Bar"
For embedded code block documentation you can also use .. code-block::
:
proc foo*() =
## Beginning of comment.
##
## .. code-block::
## :test:
## foo()
##
## Rest of comment.
raise newException(Exception, "boo!")
The best examples are self-contained and specific. This means they show how to do one thing. You should use headings to make them as easy to understand as possible, for example:
## Initialising an empty table
## ---------------------------
##
## An empty table can be created on the stack or on the heap.
##
## Stack allocated table
## ~~~~~~~~~~~~~~~~~~~~~
##
## .. code-block:: nim
## :test:
## import tables
## var phonebook = initTable[string, string]()
##
## Heap allocated table
## ~~~~~~~~~~~~~~~~~~~~~
##
## .. code-block:: nim
## :test:
## import tables
## var phonebook = newTable[string, string]()
If your example is more than 5 lines of code, then it’s likely too long. Consider separating it into multiple examples.
Nim’s documentation generator uses reStructuredText, take a look at some references if you want to get more familiar with it.
There is a list of needed libraries, can you help us shorten it?
Once you have written a library, you can send a PR to nimble package repo to include your package in the official list of packages!
If writing a library seems like a too demanding task, you can help improve one of the existing Nim packages by adding a feature, fixing a bug, or writing more informative documentation.
If you need any help, the Nim community is very welcoming. Ask a question in Nim’s IRC Channel on Freenode, Nim’s room on Gitter or the Nim Telegram group and somebody will help you. Other communication channels can be found on our community page.
Happy coding!
The Nim team is happy to announce that the latest release of Nim, version 0.19.0, is now available. Nim is a systems programming language that focuses on performance, portability and expressiveness.
If you have installed a previous version of Nim using choosenim
,
getting Nim 0.19.0 is as easy as:
$ choosenim update stable
If you don’t have it already, you can get choosenim
by following
these instructions or you can install
Nim by following the instructions on our
install page.
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:
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[0.0 .. Inf]
. More details in language manual.nimcache
for the native code targets was
changed. Read the compiler user guide
for more information.system.expr
or the old type aliases starting with a T
or P
prefix have been removed.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.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!
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.
For more information, see the Nimble v0.9.0 changelog.
Our contributors are amazing, and there is far too many to list here. Big thanks to all of you, we couldn’t have pulled off this release without you!
re.split
for empty regular expressions now yields every character in
the string which is what other programming languages chose to do.The returned tuple of system.instantiationInfo
now has a third field
containing the column of the instantiation.
cookies.setCookie
no longer assumes UTC for the expiration date.strutils.formatEng
does not distinguish between nil
and ""
strings anymore for its unit
parameter. Instead the space is controlled
by a new parameter useUnitSpace
.
The times.parse
and times.format
procs have been rewritten.
The proc signatures are the same so it should generally not break anything.
However, the new implementation is a bit stricter, which is a breaking change.
For example parse("2017-01-01 foo", "yyyy-MM-dd")
will now raise an error.
proc `-`*(a, b: Time): int64
in the times
module has changed return type
to times.Duration
in order to support higher time resolutions.
The proc is no longer deprecated.
The times.Timezone
is now an immutable ref-type that must be initialized
with an explicit constructor (newTimezone
).
posix.Timeval.tv_sec
has changed type to posix.Time
.
math.`mod`
for floats now behaves the same as mod
for integers
(previously it used floor division like Python). Use math.floorMod
for the old behavior.
For string inputs, unicode.isUpper
and unicode.isLower
now require a
second mandatory parameter skipNonAlpha
.
For string inputs, strutils.isUpperAscii
and strutils.isLowerAscii
now
require a second mandatory parameter skipNonAlpha
.
osLastError
is now marked with sideEffect
The procs parseHexInt
and parseOctInt
now fail on empty strings
and strings containing only valid prefixes, e.g. “0x” for hex integers.
terminal.setCursorPos
and terminal.setCursorXPos
now work correctly
with 0-based coordinates on POSIX (previously, you needed to use
1-based coordinates on POSIX for correct behaviour; the Windows behaviour
was always correct).
lineInfoObj
now returns absolute path instead of project path.
It’s used by lineInfo
, check
, expect
, require
, etc.
net.sendTo
no longer returns an int and now raises an OSError
.threadpool
’s await
and derivatives have been renamed to blockUntil
to avoid confusions with await
from the async
macro.re.split
now also supports the maxsplit
parameter for consistency
with strutils.split
.system.toOpenArray
in order to support zero-copy slicing
operations. This is currently not yet available for the JavaScript target.getCurrentDir
, findExe
, cpDir
and mvDir
procs to
nimscript
.times
module now supports up to nanosecond time resolution when available.times.Duration
for representing fixed durations of time.times.convert
for converting between different time units,
e.g days to seconds.algorithm.binarySearch[T, K]
with the cmp
parameter.algorithm.upperBound
.math.arcsinh
, math.arccosh
and math.arctanh
procs.math.cot
, math.sec
and math.csc
; and their hyperbolic, inverse and inverse hyperbolic functions, math.coth
, math.sech
, math.csch
, math.arccot
, math.arcsec
, math.arccsc
, math.arccoth
, math.arcsech
and math.arccsch
procs.math.floorMod
and math.floorDiv
for floor based integer division.rationals.`div
,
rationals.
mod```, rationals.floorDiv
and rationals.floorMod
for rationals.math.prod
for product of elements in an openArray.parseBinInt
to parse a binary integer from a string, which returns the value.parseOct
and parseBin
in parseutils now also support the maxLen
argument similar to parseHexInt
.flush
for memory mapped files.MemMapFileStream
.eventParser
to the pegs
module.macros.copyLineInfo
to copy lineInfo from other node.system.ashr
an arithmetic right shift for integers.future
has been renamed to sugar
.macros.callsite
is now deprecated. Since the introduction of varargs
parameters this became unnecessary.
macros.astGenRepr
, macros.lispRepr
and macros.treeRepr
now escapes the content of string literals consistently.macros.NimSym
and macros.NimIdent
is now deprecated in favor
of the more general NimNode
.macros.getImpl
now includes the pragmas of types, instead of omitting them.macros.hasCustomPragma
and macros.getCustomPragmaVal
now
also support ref
and ptr
types, pragmas on types and variant
fields.system.SomeReal
is now called SomeFloat
for consistency and
correctness.algorithm.smartBinarySearch
and algorithm.binarySearch
is
now joined in binarySearch
. smartbinarySearch
is now
deprecated.terminal
module now exports additional procs for generating ANSI color
codes as strings.val
for the CritBitTree[int].inc
proc.test
block of unittest
now shows its type in
error message.compiler/nimeval
API was rewritten to simplify the “compiler as an
API”. Using the Nim compiler and its VM as a scripting engine has never been
easier. See tests/compilerapi/tcompilerapi.nim
for an example of how to
use the Nim VM in a native Nim application.val
for the CritBitTree[T].incl
proc.tgamma
was renamed to gamma
. tgamma
is deprecated.pegs
module now exports getters for the fields of its Peg
and NonTerminal
object types. Peg
s with child nodes now have the standard items
and pairs
iterators.accept
socket procedure defined in the net
module can now accept
a nil socket.x.y[:z]
which is transformed into y[z](x)
by the parser.func
is now an alias for proc {.noSideEffect.}
.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 matchers.
typedesc
special type has been renamed to just type
.static
and type
are now also modifiers similar to ref
and ptr
.
They denote the special types static[T]
and type[T]
.static
now supports specifying
the desired target type (as a concrete type or as a type class)type
operator now supports checking that the supplied expression
matches an expected type constraint.(1,)
with a
trailing comma. The underlying AST is nnkTupleConstr(newLit 1)
for this
example. nnkTupleConstr
is a new node kind your macros need to be able
to deal with!cstring
for the JS target is now mapped
to charCodeAt
.ref object
with inheritance rather than object
with
inheritance to prevent this issue.not nil
type annotation now has to be enabled explicitly
via {.experimental: "notnil"}
as we are still not pleased with how this
feature works with Nim’s containers.'c
and 'C'
suffix for octal literals is now deprecated to
bring the language in line with the standard library (e.g. parseOct
).The dot style for import paths (e.g import path.to.module
instead of
import path/to/module
) has been deprecated.
The importcpp
pragma now allows importing the listed fields of generic
C++ types. Support for numeric parameters have also been added through
the use of static[T]
types.
(#6415)
Native C++ exceptions can now be imported with importcpp
pragma.
Imported exceptions can be raised and caught just like Nim exceptions.
More details in language manual.
nil
for strings/seqs is finally gone. Instead the default value for
these is "" / @[]
. Use --nilseqs:on
for a transition period.
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.
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[0.0 .. Inf]
,
are now supported.{.this.}
pragma has been deprecated. It never worked within generics and
we found the resulting code harder to read than the more explicit obj.field
syntax.“Memory regions” for pointer types have been deprecated, they were hardly used
anywhere. Note that this has nothing to do with the --gc:regions
switch
of managing memory.
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.jsondoc2
has been renamed jsondoc
, similar to how doc2
was renamed
doc
. The old jsondoc
can still be invoked with jsondoc0
.#? braces
parsing mode was removed.The undocumented PHP backend was removed.
The VM’s instruction count limit was raised to 3 million instructions in order to support more complex computations at compile-time.
Support for hot code reloading has been implemented for the JavaScript
target. To use it, compile your code with --hotCodeReloading:on
and use a
helper library such as LiveReload or BrowserSync.
A new compiler option --cppCompileToNamespace
puts the generated C++ code
into the namespace “Nim” in order to avoid naming conflicts with existing
C++ code. This is done for all Nim code - internal and exported.
Added macros.getProjectPath
and ospaths.putEnv
procs to Nim’s virtual
machine.
The deadCodeElim
option is now always turned on and the switch has no
effect anymore, but is recognized for backwards compatibility.
experimental
is now a pragma / command line switch that can enable specific
language extensions, it is not an all-or-nothing switch anymore.
Nintendo Switch was added as a new platform target. See the compiler user guide for more info.
macros.bindSym now capable to accepts not only literal string or string constant expression. bindSym enhancement make it also can accepts computed string or ident node inside macros / compile time functions / static blocks. Only in templates / regular code it retains it’s old behavior. This new feature can be accessed via {.experimental: “dynamicBindSym”.} pragma/switch.
On Posix systems the global system wide configuration is now put under /etc/nim/nim.cfg
,
it used to be /etc/nim.cfg
. Usually it does not exist, however.
On Posix systems the user configuration is now looked under $XDG_CONFIG_HOME/nim/nim.cfg
(if XDG_CONFIG_HOME
is not defined, then under ~/.config/nim/nim.cfg
). It used to be
$XDG_CONFIG_DIR/nim.cfg
(and ~/.config/nim.cfg
).
Similarly, on Windows, the user configuration is now looked under %APPDATA%/nim/nim.cfg
.
This used to be %APPDATA%/nim.cfg
.
Fixed “constructor pragma leads to “Most Vexing Parse” in c++ code gen” (#6837)
Fixed “streams.readLine(): string should raise IOError, but doesn’t” (#5281)
execute("echo 1")
=> Error: cannot ‘importc’ variable at compile time”
(#7522)callsite
builtin”
(#7369)Fixed “JS codegen - indexing into cstring.” (#4470)
Fixed “nnkBracketExpr.newTree now returns tuple of NimNodes breaking newTree chaining” (#7610)
Fixed ““newNilLitNode” printed when some objects’ AST is dumped shold be “newNilLit”” (#7595)
awaitAny()
problem on macOS”
(#7638)var T
and lent T
to improve Nim’s memory safety”
(#7373)Fixed “Better compiler warning/error messages” (#7749)
Fixed “Issues with finish.exe” (#7747)
threadvar
not working as expected (differs from C++ thread_local and D static)”
(#7565)$
for openArray”
(#7940)$
doesn’t work for CritBitTree[void]”
(#7987)inc
to add new keys, only the first added key gets the value 1”
(#7990)Fixed “Error: obsolete usage of ‘defined’, use ‘declared’ instead” (#7997)
Fixed “[regression]: nim doc
is
with string”
(#8129)Fixed “unixToNativePath cause IndexError with Empty string or “.”” (#8173)
Fixed “Octal int literal behavior differs from parseOct
- change parseOct
?”
(#8082)
Fixed “[travis] flaky test: “No output has been received” caused by no prompt on “already exists. Overwrite?” after nimble install
”
(#8227)
ospaths.absolutePath
function to get absolute path from a path”
(#8174)Fixed “Render bug with prefix and implicit string/cstring conversion” (#8287)
Error: cannot 'importc' variable at compile time
shows wrong context”
(#7405)htmlparser.untilElementEnd
is not GC-safe”
(#8338)nim check
internal error”
(#8230)nim doc
fails when source file contains doAssertRaises
in isMainModule”
(#8223)to
does not support objects with distinct types”
(#8037)Fixed “await inside stmtListExpr inside a case stmt crashes compiler” (#8399)
Fixed “[os] failed operations (eg existsOrCreateDir) should show runtime context (eg file/dir) it failed for” (#8391)
Fixed “excessiveStackTrace:on shows non-absolute file in stacktrace” (#7492)
nim doc foo
generates stuff that should be under a .gitignore’d directory”
(#8323)o
is actually unused and docs output dir hardcoded regardless of o”
(#8419)add
or setLen
being deallocated”
(#7833)echo
not thread safe on windows, causing [appveyor] flaky test: Failure: reOutputsDiffer in tforstmt.nim”
(#8511)undistinct(T)
”
(#8519)Fixed “.cache/projectname
pollutes .cache
- put in .cache/Nim/projectname
instead”
(#8599)
mapIt
still can’t be used with openArray
even after #8543, #8567: fails during bootstrap”
(#8577)Fixed “$
for Option[string] types should double-quote the output”
(#8658)
nim doc2 --project -o:doc/
cannot find files in subdirectories”
(#8218)Fixed “onFailedAssert
does not affect doAssert
”
(#8719)
Fixed “[cmdline] [minor] --hint.foo:on
as alias for --hint[foo]:on
: avoids edge cases with [
that needs to be escaped on cmd line + other places”
(#8739)
unidecode
example”
(#8768)loadUnidecodeTable
use the path to unicode.dat on user’s system by default”
(#8767)unidecode
example”
(#8768)Fixed “Pure enums allow using the same name but allow nonqualification with quirky behaviour” (#8066)
errorStream
doesn’t seem to work”
(#8442)Error: undeclared identifier: '|'
when using |
inside a runnableExamples:
”
(#8694)Hint: operation successful: runnableExamples
even though operation failed: compile error is ignored”
(#8831)runnableExamples
don’t have own scope for imports”
(#7285)nim check
segfaults”
(#8028)except BaseClass
doesn’t work”
(#8740).
operator can’t be parsed”
(#8797)unsafeAddr
operator to the Nim manual”
(#5038)using
types should have higher precedence”
(#8565)-d:identifier
is case insensitive (not partially case insensitive)”
(#7506)writeStackTrace
proc listed twice in docs”
(#3655)writeStackTrace
proc listed twice in docs”
(#3655)Fixed “Regression: stack trace line numbers are messed up for asserts” (#8928)
Fixed “Core dump for RTree module – regression” (#8883)
system.cmp
returns different results for string on different operating systems”
(#8930)Fixed “scanf Invalid node kind nnkBracketExpr for macros.$
”
(#8925)
strutils.nim(1533, 29) Error: illegal conversion from '-1' to '[0..9223372036854775807]'
with strutils.replace on empty string at CT”
(#8911)$
”
(#8925)Fixed “[minor] operator symbols in anchor text disappear, causing anchor clashes” (#7500)
We are proud to announce the launch of the official 2018 Nim Community Survey! No matter whether you use Nim today, have used Nim previously, or never used Nim before; we want to know your opinions. Your feedback will help the Nim project understand its strengths and weaknesses, and to determine development priorities for the future.
It shouldn’t take you much longer than 5 to 10 minutes to complete this survey. Submissions will be accepted until around the 23rd of July, depending on the response rates. If you have any questions or feedback, please don’t hesitate to get in touch with us via email at [email protected] or on the Nim Forum.
This is now the third year in which this survey has been running. An analysis of the results for the past years can be found at the following links:
We would appreciate your help in spreading the word about this survey. Share the Google Forms link on your social network feeds, with your colleagues and in other communities.
Thank you to everyone that helped develop and test the survey! Once the submission period ends, the results will be shown here and publicised via Twitter, the Nim Forum and IRC.
Thanks for your time!
The Nim team is happy to announce that the latest release of Nim, version 0.18.0, is now available. Nim is a systems programming language that focuses on performance, portability and expressiveness.
If you have installed a previous version of Nim using choosenim
,
getting Nim 0.18.0 is as easy as:
$ choosenim update stable
If you don’t have it already, you can get choosenim
by following
these instructions or you can install
Nim manually by following the instructions on our
install page.
Note that Windows users might still have an easier time with the
unzip+finish.exe method of installing Nim which is described on the
install page.
It’s been a while since our last release, but we’ve been busy. At over 1000 commits since the last release, v0.18.0 is one of (if not the) biggest releases of Nim ever.
We have mentioned multiple times that this will be a major release. Primarily because our goal has been to clean up the standard library significantly in preparation for v1.0. We’ve made massive progress in this release to achieve that goal. The downside is that this release has a much larger proportion of breaking changes than normal releases, but it is all in the spirit of a cleaner Nim v1.0.
You will find that the []
indexing operator which takes a slice now raises
an IndexError
exception when it is out of bounds. Previously it would have
simply returned the part of the string that was captured. You may find that your
program hasn’t taken this into account and will now crash with an IndexError
exception. To get back the previous behaviour, use the substr
procedure.
Here is an example of the issue and how to get around it:
var myString = "hello world"
doAssertRaises IndexError:
discard myString[6 .. 45]
doAssert myString.substr(6, 45) == "world"
The $
operator now handles collections differently. For example:
doAssert $(@["23", "12"]) == "@[\"23\", \"12\"]"
# Whereas in 0.17.2:
doAssert $(@["23", "12"]) == "@[23, 12]"
An array[x, char]
can no longer be converted to a cstring
type. This
has the side-effect of allowing $
to be defined on an array:
var x: array[5, char]
doAssert $x == r"['\x00', '\x00', '\x00', '\x00', '\x00']"
Be sure to check out the changelog below for a comprehensive list of breaking changes. If you run into any strange regressions feel free to pop into IRC, Gitter, Discord or any of the other chat rooms/forums we have available. Links to them all are available in our community page.
Of course, this being a major new release, there are also plenty of new features.
The greatest new addition is the strformat
module. It implements string
formatting that is very similar to Python 3’s f-strings.
Formatted string literals are prefixed with fmt
or the &
operator:
import strformat
let name = "Fred"
let age = 24
let weight = 94.52
doAssert fmt"My name is {name}. I'm {age} years of age and weigh {weight:.3f}." ==
"My name is Fred. I'm 24 years of age and weigh 94.520."
For more information, take a look at the
strformat
documentation.
The documentation generator can now test your examples for you! This is done
using the new runnableExamples
macro.
proc add*(x, y: int): int =
## Adds two numbers together.
##
## Examples:
##
runnableExamples:
doAssert add(5, 5) == 10
doAssert add(-5, 2) == -3
x + y
If you save this as addLib.nim
and then generate its documentation via
nim doc addLib.nim
, you should see something like this:
Hint: /tmp/addLib_examples [Exec]
Hint: operation successful (13129 lines compiled; 0.492 sec total; 19.742MiB peakmem; Debug Build) [SuccessX]
The code under runnableExamples
will be embedded in the procedure’s
documentation.
If your examples have an error in them then you will see it, together with a stack trace if your error occurs at runtime. This is great for ensuring that your documentation is up-to-date.
mapLiterals
This is a new macro that allows you to easily create array and sequence literals.
import sequtils
let x = mapLiterals([12, 34, 15, 1], uint32)
doAssert x is array[4, uint32]
The new TLSF algorithm has been implemented to reduce memory fragmentation.
This has a side effect of making alloc
and dealloc
O(1) operations.
There have been a number of various improvements to the asynchronous IO modules in the stdlib. There is no longer an “upcoming” and standard asyncdispatch split, the former was merged and is now the default asyncdispatch implementation.
A new getIoHandler
procedure is now available, it returns a handle
to the underlying IO completion port or epoll/kqueue fd used by asyncdispatch.
Main advantage of this is that libraries now have even greater control over the
event loop.
As an example, it allows much more efficient HTTP server implementations
(one such implementation is called httpbeast).
A new implementation of async await has also been added for the JavaScript
backend in the asyncjs
module.
In the release are also updates to the Nim package manager. The latest version of Nimble is included and contains multiple new features and bug fixes.
The major new feature is the support for multiple Nimble packages in a single Git/Hg repository.
Check out the changelog for a list of changes since Nimble’s last release.
Our contributors are amazing, and there is far too many to list here. Big thanks to all of you, we couldn’t have pulled off this release without you!
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
.
basic2d
deprecated: use glm
, arraymancer
, neo
, or another package insteadbasic3d
deprecated: use glm
, arraymancer
, neo
, or another package insteadgentabs
libuv
polynumeric
pdcurses
romans
libsvm
joyent_http_parser
Proc toCountTable
now produces a CountTable
with values corresponding 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
.
readPasswordFromStdin
proc has been moved from the rdstdin
to the terminal
module, thus it does not depend on linenoise anymore.\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 “heterogeneous” 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.
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
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.
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]
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.
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()
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"
mitems
generates invalid code.”
(#4910)-d:useNimRtl
and --threads:on
”
(#5143)echo
discards everything after a null character”
(#1137)[]
+ unrelated type[^1]: lib/system.nim(3536, 3) Error”
(#6692)Fixed “[Regression] value out of range” (#6710)
Fixed “Error when using multisync
macro”
(#6708)
exitcode
only”
(#6775)not nil
not working in some cases”
(#4686)Fixed “Cannot prove ‘@[v]’ is not nil” (#3993)
sequtils.any
conflicts with system.any
”
(#6932)mitems
generates invalid code.”
(#4910)--NimblePath
fails if a -
in path which is not followed by a number”
(#6949)Fixed “strange frexp behavior” (#6353)
Fixed “Ambiguous identifier between set type and proc” (#6965)
Fixed “Inconsistent behavior with sequence and string slicing” (#6223)
nim check
segfaults”
(#6972)Fixed “runnableExamples doesn’t work with untyped statement blocks” (#7019)
compiles(...)
with fatal
pragma causes compiler to exit early”
(#7080)int | float
causes internal compiler error”
(#6946)Fixed “strtabs.getOrDefault is inconsistent with tables.getOrDefault” (#4265)
..<
regression”
(#6992)This year has been filled with some pretty major achievements for us, because of this I decided to write a little article summarising what we’ve accomplished in 2017 and to give a bit of a preview of what’s in store for 2018.
times
module, with more to come.
(Thanks @GULPF)alloc
and dealloc
are now O(1) operations.As always, I’d like to invite you to join our community to give us feedback or just to chill out with us, all the information you need to do so is available on our community page.
Thank you all for your incredible support so far, and have a happy new year!
本指南讨论了一些用于注释和生成文档、分析和调试nim代码的实用工具。
We have recently closed the 2017 Nim Community Survey. I am happy to say that we have received exactly 603 responses, huge thanks go to the people that took the time to respond. We’re incredibly thankful for this very valuable feedback.
For the results of the previous year’s survey, take a look at the 2016 results analysis.
Our survey ran from the 23rd of June 2017 until the 14th of August 2017. The goal of this survey was to primarily determine how our community is using Nim, in order to better understand how we should be improving it. In particular, we wanted to know what people feel is missing from Nim in the lead up to version 1.0. We have also asked our respondents about how well the Nim tools worked, the challenges of adopting Nim, the resources that they used to learn Nim and more. We repeated the survey with the same questions this year to see how we did over the past year.
Unlike in the last year, this analysis will not go over all the results. Instead it will only go over the most interesting answers.
In comparison to last year we unfortunately received 187 less responses. I suspect the reason for this decrease was the fact that we were not able to advertise the survey as well as the previous year, I got lucky last year by sharing a link to our survey in the Rust community survey results Hacker News thread. This year Rust’s results were late and so I didn’t get the same opportunity.
But with that in mind I think the number of responses is still good.
Like last year we split up our respondents into three groups:
This allowed us to ask each group specific questions. For example, we asked ex-Nim users why they’ve stopped using Nim.
This year the proportion of responses from current Nim users has grown from 39% to 44%, and as a result of this there is less responses from those that never used Nim (decrease from 37% to 30%). This is likely due to a higher proportion of responses from the Nim community.
But this isn’t the whole story, the number of ex-Nim users went up from 24% to 26%.
This section includes answers from current Nim users only (44% of respondents).
Just like last year, a large proportion of our Nim users are new. This suggests that our community is growing and is a good sign. On the other end of the spectrum we can see that there is a significantly higher number of Nim users that have been using Nim for more than 24 months.
The questions related to these topics got very similar results to last year:
This was a free-form question so I will just pick out some of the common and interesting answers. According to the respondents, Nim is used at work for:
Another free-form question, I will pick out some of the things that respondents have identified:
In this section of the survey, we wanted to find out the tools that Nim users are utilising when developing Nim applications.
Programmers swear by their editors. What does the Nim community prefer?
There is still a large number of Vim users, but now they are overwhelmed by the Visual Studio Code users. VS Code has gone from 16.5% to 35.5%!
Again, the results for these questions are very similar to last year. I will simply provide a summary:
We wanted to find out how users are installing Nim. In particular I wanted to
find out whether choosenim
was getting adopted.
It seems that the majority are still in fact installing Nim by cloning the Nim repo manually. This makes sense as Nim is still evolving quickly, for most people it makes sense to stay on the bleeding edge.
This is a good list of projects for the Nim community to take up. The respondent’s were asked to freely give libraries that they need, here are their (mostly raw) answers (duplicates left in to show popularity):
Summarising again:
This question is new. It shows that ex-Nim users are fairly equally distributed based on the amount of time they used Nim before deciding to stop.
This was a free-form question. Some of the common answers were as follows:
Here are some other interesting reasons:
GOTO
.As with the previous year, the most popular answer to this question was once again to do with maturity of Nim as well as lack of libraries and good IDE support.
There were also a number of free-form answers to this question:
This received a number of free-form answers which I will outline here:
There was a number of free-form answers as well. Most of them spoke about providing all approaches, i.e. the “have the cake and eat it too” approach. Many are conscious of the fact that a GC makes programming smoother so they don’t want the Rust model, but for use cases where it’s necessary they do want it.
Like last year, at the end of the survey we gave our respondents a chance to speak their mind about anything they wish, with a simple question: “Anything else you’d like to tell us?”
There was a lot of great feedback given in this question from people who obviously really care deeply about Nim. There is too much to outline here, but rest assurred that we will take it all into account and do our best to act on it.
In addition to feedback, we were also overwhelmed by the amount of positive comments in the answers to this question. There was a lot of support from the community thanking us for our work and determination.
I’ll let some quotes speak for themselves:
Keep up the good job. I love Nim!
Great work so far, keep it going!
Please just keep up the excelent work. Nim is awesome!
Awesome language, and great community!
Our community is truly brilliant. We thank each and every one of you for filling out this survey and hope that you will help us tackle some of the challenges that face Nim.
This survey was a good place to give us feedback, but please don’t wait for the next one. We are always looking to hear more from you and we hope that you will participate in discussions relating to this survey as well the future of Nim.
Thanks for reading, and have a good day!
The Nim team is happy to announce that the latest release of Nim, version 0.17.2, is now available. Nim is a systems programming language that focuses on performance, portability and expressiveness.
The major new feature in this release is the support for .nimble-link
files.
This has been added in order to support the latest Nimble version with its “develop” feature. For more information, see nimble
.
This is however primarily a bug fix release, with the most important bugfixes including the long standing codegen bugs that triggered GC crashes. Updating is recommended!
Be sure to check out the changelog below for a comprehensive list of changes.
This release also includes version 0.8.8 of the Nimble package manager, be sure to check out its changelog for a list of changes since its last release.
You can download the latest release of Nim from the download
page. If you’re using choosenim
then you can easily update to the latest version by running the following:
$ choosenim update stable
do
notation parsing rules in v0.17.0 have been
reverted.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.
invalid type
”
(#3784)static[T]
“
(#3153)concept
”
(#5888)^
operator fails on floats”
(#5966)locks
for use in a generic type”
(#6049)Fixed “ReraiseError when using try/except within finally block” (#5871)
Fixed “Nim Tutorial doc bugs” (#6125)
Fixed “0.17.0 Regression: Statement macro from tutorial does not compile anymore” (#5918)
[]=
A should support val = 0”
(#4366)We are proud to announce the launch of the official 2017 Nim Community Survey! No matter whether you use Nim today, have used Nim previously, or never used Nim before; we want to know your opinions. Your feedback will help the Nim project understand its strengths and weaknesses, and to determine development priorities for the future.
It shouldn’t take you much longer than 5 to 10 minutes to complete this survey. Submissions will be accepted until around the 23rd of July, depending on the response rates. If you have any questions or feedback, please don’t hesitate to get in touch with us via email at [email protected] or on the Nim Forum.
We would appreciate your help in spreading the word about this survey. Share the above link on your social network feeds, with your colleagues and in other communities.
Thank you to everyone that helped develop and test the survey! Once the submission period ends, the results will be shown here and publicised via Twitter, the Nim Forum and IRC.
Thanks for your time!
This is a guest post by Euan Torano cross-posted from Faster Command Line Tools in Nim. If you would like to publish articles as a guest author on nim-lang.org then get in touch with us via Twitter or otherwise.
After having read the blog post titled Faster Command Line Tools in D
by Jon Degenhardt on the D Blog, I was interested to see how Nim would stack up performing the same task.
Rather than explain the task again, I might as well quote the reference post that inspired me:
It’s a common programming task: Take a data file with fields separated by a delimiter (comma, tab, etc), and run a mathematical calculation involving several of the fields. Often these programs are one-time use scripts, other times they have longer shelf life. Speed is of course appreciated when the program is used more than a few times on large files.
The specific exercise we’ll explore starts with files having keys in one field, integer values in another. The task is to sum the values for each key and print the key with the largest sum.
With the first field as key, second field as value, the key with the max sum is B, with a total of 13.
Fields are delimited by a TAB, and there may be any number of fields on a line. The file name and field numbers of the key and value are passed as command line arguments.
This is quite a simple program. All that we need to do is read a file, parse it as CSV data with a tab delimiter and sum the counts.
Luckily, Nim’s standard library has many useful modules to help with common tasks like these:
FileStream
type for reading from and writing to files.CountTable
type designed to map a key to its number of occurrences - precisely the task we’re trying to accomplish!The code is pretty simple, so let’s start by looking at it in its entirety:
import os, strutils, streams, tables, parsecsv
const
Delim = '\t'
proc main() =
if paramCount() < 3:
quit("synopsis: " & getAppFilename() & " filename keyfield valuefield")
let
filename = paramStr(1)
keyFieldIndex = parseInt(paramStr(2))
valueFieldIndex = parseInt(paramStr(3))
maxFieldIndex = max(keyFieldIndex, valueFieldIndex)
var
sumByKey = newCountTable[string]()
file = newFileStream(filename, fmRead)
if file == nil:
quit("cannot open the file " & filename)
defer: file.close()
var csv: CsvParser
open(csv, file, filename, separator=Delim)
while csv.readRow():
if len(csv.row) > maxFieldIndex:
sumByKey.inc(csv.row[keyFieldIndex], parseInt(csv.row[valueFieldIndex]))
if sumByKey.len() == 0:
echo "No entries"
else:
let largest = sumByKey.largest()
echo "max_key: ", largest[0], " sum: ", largest[1]
main()
Most of this should be pretty self explanatory. I’ve used the same names as those used in the D code samples provided in the original blog post to keep things looking similar.
Obviously the start of the program is all about making sure we have enough command line arguments, and collecting them up. In Nim, we use paramStr()
from the os module to access command line arguments.
From there, we create a new count table, open the CSV file for reading (fmRead
opens the file in read mode) and start the CSV parser.
We then read through all of the rows in the CSV file, and if the row has enough fields to be a valid row, we increment its entry within the count table.
With this initial implementation complete, I built it in release mode (nim c -d:release test_csv.nim
) and benchmarked it against the Python implementation and the final optimised D implementation (max_column_sum_by_key_v4b.d
).
The versions of the tools used in this post are as follows:
Python 2.7.13
DMD64 D Compiler v2.074.0
LDC - the LLVM D compiler (1.2.0): based on DMD v2.072.2 and LLVM 4.0.0
Nim Compiler Version 0.17.0 (2017-05-18) [MacOSX: amd64]
Apple LLVM version 8.1.0 (clang-802.0.42)
Testing was performed against the D version compiled using both the reference DMD
D compiler, and the LDC
LLVM based D compiler. The compilation switches used for the D versions were as follows:
dmd -O -release -inline -boundscheck=off -of=./D/csv_test ./D/csv_test.d
ldc2 -of=./D/csv_test_ldc -O -release -boundscheck=off ./D/csv_test.d
I then ran all of these implementations against the same ngram file from the Google Books project, making sure I got the expected output, which is as follows:
max_key: 2006 sum: 22569013
The benchmark was ran on my mid 2014 MacBook Pro with a 2.8GHz Intel Core i7 running macOS Sierra 10.12.4. The benchmark made use of the repeat.rb
script from Kostya’s benchmarks project to run each version 10 times and report the fastest run time. This script also provides the added bonus of providing the peak amount of memory used by each version. Here are the results:
Python...
max_key: 2006 sum: 22569013
21.70s
max_key: 2006 sum: 22569013
32.06s
max_key: 2006 sum: 22569013
17.83s
max_key: 2006 sum: 22569013
18.29s
max_key: 2006 sum: 22569013
23.73s
max_key: 2006 sum: 22569013
18.09s
max_key: 2006 sum: 22569013
17.58s
max_key: 2006 sum: 22569013
17.86s
max_key: 2006 sum: 22569013
16.92s
max_key: 2006 sum: 22569013
15.98s
MIN TIME: 15.98s
PEAK MEM: 7.9Mb
D (DMD)...
max_key: 2006 sum: 22569013
2.45s
max_key: 2006 sum: 22569013
2.33s
max_key: 2006 sum: 22569013
2.24s
max_key: 2006 sum: 22569013
2.36s
max_key: 2006 sum: 22569013
2.28s
max_key: 2006 sum: 22569013
2.21s
max_key: 2006 sum: 22569013
2.28s
max_key: 2006 sum: 22569013
2.21s
max_key: 2006 sum: 22569013
2.28s
max_key: 2006 sum: 22569013
2.30s
MIN TIME: 2.21s
PEAK MEM: 2.3Mb
D (LDC)...
max_key: 2006 sum: 22569013
1.42s
max_key: 2006 sum: 22569013
1.34s
max_key: 2006 sum: 22569013
1.34s
max_key: 2006 sum: 22569013
1.33s
max_key: 2006 sum: 22569013
1.88s
max_key: 2006 sum: 22569013
1.31s
max_key: 2006 sum: 22569013
1.35s
max_key: 2006 sum: 22569013
1.36s
max_key: 2006 sum: 22569013
1.29s
max_key: 2006 sum: 22569013
1.26s
MIN TIME: 1.26s
PEAK MEM: 2.4Mb
Nim...
max_key: 2006 sum: 22569013
1.36s
max_key: 2006 sum: 22569013
1.30s
max_key: 2006 sum: 22569013
1.31s
max_key: 2006 sum: 22569013
1.35s
max_key: 2006 sum: 22569013
1.36s
max_key: 2006 sum: 22569013
1.45s
max_key: 2006 sum: 22569013
1.47s
max_key: 2006 sum: 22569013
1.50s
max_key: 2006 sum: 22569013
1.53s
max_key: 2006 sum: 22569013
1.56s
MIN TIME: 1.30s
PEAK MEM: 1.9Mb
D (compiled with LDC and using the fifth iteration of the code from the original blog post) comes in fastest at 1.26 seconds. Nim comes in second, at 1.30 seconds - only 0.04 seconds behind.
Nim does use 0.5Mb less memory than the D version built with LDC, and is doing slightly more work - the parsecsv
module will handle escaped values, unlike the naive approach of simply splitting strings on the tab character.
Python is clearly the loser, taking 12 times as long to complete the processing as the Nim version does and using 4 times the memory to do so.
This test also shows the gulf between the DMD and LDC compilers. The same code compiled with the DMD compiler takes almost a whole second longer to execute than it does when compiled with LDC, though it does use 0.1Mb less memory at its peak.
I’m sure that with some tuning, I could get the Nim version to perform even quicker, but for a 0.04 second time difference, I decided not to put that effort in.
Having come this far, I though I might as well benchmark how long compilation times are for the two D implementations and the Nim implementation. Obviously, the Python implementation is excluded from this test.
I cleared out all build artefacts (such as the *.o
files for D and the nimcache
folder for Nim) along with the built executables, then simply timed each build. Here are the results:
real 0m0.947s
real 0m2.296s
real 0m0.955s
It turns out that the DMD compiler is much quicker than the LDC compiler. Obviously all the optimisations that LLVM makes take a little while longer to complete.
And that was the end of my little test. It turns out that Nim can certainly hold its own when it comes to parsing CSV files.
I’d be interested to see how things run on other machines and operating systems to see how things are across platforms. I’m also sure there are far better ways I could benchmark these implementations, which is why I’ve posted the project publicly on GitHub - I’d welcome any enhancements to any of the versions or the benchmarking scripts, and would certainly welcome some more results to see how things stack up!
The Nim team is happy to announce that the latest release of Nim, version 0.17.0, is now available. Nim is a systems programming language that focuses on performance, portability and expressiveness.
This release fixes the most important regressions introduced in version 0.16.0. In particular memory manager and channel bugs have been fixed. There was also many significant improvements to the language, in particular a lot of work was put into concepts. Zahary has been leading this effort and we thank him for his hard work. Be sure to check out the changelog below for a comprehensive list of changes.
The NSIS based
installer is not provided anymore as the Nim website moved to https
and
this caused NSIS downloads to fail. The latest version of Nim for Windows can
still be downloaded as a zip archive from the
downloads page.
We would also like to invite you to test a brand new tool that aims to make
the installation and management of multiple Nim versions much easier. This tool
is called choosenim
and allows you to install the latest version of Nim
with a single command.
Check out the
installation instructions
on GitHub to give it a go, but keep in mind that this tool is still
experimental.
This release also includes version 0.8.6 of the Nimble package manager, be sure to check out its changelog for a list of changes since its last release.
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.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”.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.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.}
..base
methods anymore. This means
you need to annotate them with .gcsafe
or similar to clearly declare
upfront every implementation needs to fulfill 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
.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.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.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.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)
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)
finish
tool can now download MingW for you should it not find a
working MingW installation.--debugger:native
is enabled. Debuggers can read these .ndi
files in order to improve
debugging Nim code.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.
.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.
.procvar
annotation is not required anymore. That doesn’t mean you
can pass system.$
to map
just yet though.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 “await inside array/dict literal produces invalid code” (#5314)
sym is not accessible
in compile time”
(#5354)Fixed “Nim hangs forever in infinite loop in nre library” (#5444)
==
for OrderedTable should consider equal content but different size as equal.”
(#5487)is
involving template”
(#5360)path
config option doesn’t work when compilation is invoked from a different directory”
(#5228)joinThreads
for windows”
(#4972)Fixed “Bugs with concepts?” (#2882)
compiles
”
(#5638)Fixed “MultipartData in httpclient.Post appears to break header” (#5710)
We’re happy to announce that the latest release of Nim, version 0.16.0, is now available!
As always, you can grab the latest version from the downloads page.
This release includes over 80 bug fixes and improvements. To see a full list of changes, take a look at the detailed changelog below.
Some of the most significant changes in this release include: a major new Nimble release, an improved import syntax, and the stabilisation of name mangling rules enabling faster compile times.
The new Nimble release that is included with Nim 0.16.0 includes a variety of new features and bug fixes. The most prominent of which is the improved output system, as shown in the figure below.
For a full list of changes in Nimble, see its changelog.
The new import syntax makes it easier to import multiple modules from the same package or directory. For example:
import compiler/ast, compiler/parser, compiler/lexer
import compiler / [ast, parser, lexer]
The two are equivalent, but the new latter syntax is less redundant.
Finally, the code responsible for name mangling in the generated C and C++ code has been improved to reduce compile times. In particular, compile-time for the common edit-compile-run cycles have been reduced.
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.error
proc of macro
module to provide better
error messageAdded 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.
distros
(doc) that can be used in Nimble
packages to aid in supporting the OS’s native package managers.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
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.
==
for CountTable does not work.”
(#4946)test=
type proc call when parameter is a call to a table’s []
proc”
(#5079)importcpp
type”
(#5140)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.
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.
NimMain
not exported in DLL, but NimMainInner
is”
(#4840)We’re happy to announce that the latest release of Nim, version 0.15.0, is now available!
As always, you can grab the latest version from the downloads page.
This release includes almost 180 bug fixes and improvements. To see a full list of changes, take a look at the detailed changelog below.
Some of the most significant changes in this release include: improvements to
the documentation, addition of a new multisync
macro, and a new
HttpClient
implementation.
All pages in the documentation now contain a search box and a drop down to select how procedures should be sorted. This allows you to search for procedures, types, macros and more from any documentation page.
Sorting the procedures by type shows a more natural table of contents. This should also help you to find procedures and other identifiers.
The multisync
macro was implemented to enable you to define both
synchronous and asynchronous IO procedures without having to duplicate a
lot of code.
As an example, consider the recvTwice
procedure below:
proc recvTwice(socket: Socket | AsyncSocket): Future[string] {.multisync.} =
result = ""
result.add(await socket.recv(25))
result.add(await socket.recv(20))
The multisync
macro will transform this procedure into the following:
proc recvTwice(socket: Socket): string =
result = ""
result.add(socket.recv(25))
result.add(socket.recv(20))
proc recvTwice(socket: AsyncSocket): Future[string] {.async.} =
result = ""
result.add(await socket.recv(25))
result.add(await socket.recv(20))
Allowing you to use recvTwice
with both synchronous and asynchronous sockets.
Many of the httpclient
module’s procedures have been deprecated in
favour of a new implementation using the multisync
macro. There are now
two types: HttpClient
and AsyncHttpClient
. Both of these implement the
same procedures and functionality, the only difference is timeout support and
whether they are blocking or not.
See the httpclient module documentation for more information.
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.
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.
-d/--define
flag can now optionally take a value to be used
by code at compile time.
(doc)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.
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
.
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)
seq
data inside a queue
does not increase and crashes”
(#4422)Fixed “Explicit conversions not using converters” (#4432)
Fixed “Change console encoding to UTF-8 by default” (#4417)
Fixed “invalid C code generated (function + block + empty tuple)” (#4505)
^
with non-int types.”
(#4574)=>
macro”
(#4658)Fixed “SIGSEGV when compiling NimYAML tests” (#4699)
Fixed “module securehash not gcsafe” (#4760)
We have recently closed the 2016 Nim Community Survey. I am happy to say that we have received exactly 790 responses, huge thanks go to the people that took the time to respond. We’re incredibly thankful for this very valuable feedback.
This survey was inspired in part by the 2016 State of Rust survey. You will note that many of the questions were modelled after Rust’s survey. One of the reasons for doing this was to allow us to easily compare our results against the results obtained in the Rust survey. In addition, we of course also liked many of their questions.
Our survey ran from the 23rd of June 2016 until the 8th of August 2016. The response numbers are impressive considering Nim’s community size; at 790 they make up just over 25% of the Rust survey’s responses.
The goal of this survey was to primarily determine how our community is using Nim, in order to better understand how we should be improving it. In particular, we wanted to know what people feel is missing from Nim in the lead up to version 1.0. We have also asked our respondents about how well the Nim tools worked, the challenges of adopting Nim, the resources that they used to learn Nim and more.
It is my hope that we will be able to run a similar survey in a years time, doing so should give us an idea of whether we are improving. With these general facts in mind, let’s begin looking at specific questions.
The rationale for the first question was simple, we wanted to know where our respondents found out about Nim. This is an interesting question for us, as we do occasionally get users asking us why it took so long for them to hear about Nim. It allows us to see how effective each website is at spreading the word about Nim.
The majority of our respondents found Nim via Reddit, HackerNews or a search engine such as Google. These results are not altogether surprising. There were also a lot of “Other” responses, some of which were a bit more interesting. These included multiple mentions of habrahabr.ru, Dr. Dobb’s, and lobste.rs.
Just like the Rust survey creators, we wanted to ensure that our survey was open to both Nim users as well people who never used Nim. In addition to those two groups, we have also included a third group of people: ex-Nim users. All three are interesting, for many different reasons. Nim users can tell us how they are using Nim and also how Nim’s tooling can improve. Ex-Nim users give us an idea of why they stopped using Nim. Finally, respondents who never used Nim can tell us the reasons for not adopting it.
It’s nice to see that we have such a good range of respondents. The Rust survey had a much larger number of Rust users amongst their respondents, with no distinction between users that never used Rust and users that stopped using Rust.
This was something I thought would be interesting to have, after I saw it being used in another survey. While it does pinpoint possibly invalid respondents, I have opted against filtering those out. Mainly because that would require re-creating each of the charts generated by Google Forms manually.
According to the responses to this question, around 94% of our responses can be considered reliable.
The following questions were answered only by the 38.9% of our respondents who identified themselves as Nim users.
A large proportion of our Nim users were new. This is good news as it means that our community is growing, with a large proportion of new Nim users that could become long-term Nimians. In total, more than 35% of Nim users can be considered new having used Nim for less than 3 months. With 18% of Nim users that can be considered very new having used Nim for less than a month. This could suggest that 18% of our users have only just found out about Nim in the last week or so and have not yet got the chance to use it extensively.
The high percentages of long term Nim users are encouraging. They suggest that many users are continuing to use Nim after making it through the first few months. The sharp drop at 7-9 months is interesting, but may simply be due to the fact that there were fewer newcomers during that period, or it could be because our respondents are more likely to estimate that they have been using Nim for a year or half a year rather than the awkward 7-9 months.
The results for Nim and Rust are actually remarkably similar. They both show a drop at 7-9 months, although Rust’s isn’t as dramatic. Nim on the other hand has a significantly higher percentage of new Nim users.
An important aspect of a language’s adoption is whether it is being used for “real” work. We wanted to know how many people are using Nim in their day jobs and under what circumstances it is used.
While a vast majority of our users are not using Nim at work, more than 25% of them are. It’s encouraging to see such a high number already, even before we have released version 1.0. In fact, this percentage is likely close to 30%, because many of the “Other” responses mention using Nim for the likes of internal tools or small scripts to help with the respondent’s work.
Interestingly, a larger percentage of Nim users are using Nim at work than Rust users. The sample sizes are of course vastly different, but it’s still an interesting result. Combined, nearly 1/5th of Rust users are using Rust commercially whereas more than a quarter of Nim users are using Nim commercially.
Finding out how large the Nim projects worked on by Nim users are is also very valuable.
This shows us that currently Nim is primarily being used for small scripts and applications, with nearly 60% of the projects consisting of less than 1,000 lines of code. This makes sense as many of our users are not using Nim professionally, but are doing so in their spare time.
The numbers for part-time and full-time work users of Nim tell a different story. Over 70% of the projects written by full-time users are between 10,001 and 100,000 lines of code. Part-time users show a slightly different trend, with many more small projects, the majority being between 1,000 and 10,000 lines of code.
Overall it’s good to see that there is a few large projects out there which are composed of more than 100,000 lines of code. We expect to see the amount of large projects to grow with time, especially with version 1.0 on the way.
In comparison to Rust the proportion of project sizes for full-time users is vastly different. This is likely due to our small sample size. Project sizes for part-time users between Rust and Nim are somewhat similar, with differences of around 10% for each project size.
It’s also encouraging to see that over 50% of Nim users are planning to use Nim at work! This is slightly more than Rust’s 40% and should help Nim’s adoption into even more areas.
In this section of the survey, we wanted to find out the tools that Nim users are utilising when developing Nim applications.
Programmers are very specific when it comes to their editor of choice, because of that it’s good to know which editor is most popular among our community.
Looks like Vim is the winner with almost 30%. Followed by Sublime Text and Emacs. Aporia, the Nim IDE, gets a respectable 15.5%. There was also more than 17% of answers which included “Other” editors, such as: Notepad++, Geany, gedit, and Kate.
This question gave us information about the most popular target operating systems, as well as some of the more obscure ones. We have asked this question to find out the platforms on which Nim applications run on most frequently.
This question allowed multiple choices, so each percentage is out of the total number of respondents for this question. For example, 80.7% of the respondents selected “Linux” but only 26.6% selected OS X.
This makes Linux by far the most popular target for Nim applications. Some “Other” targets included: BSD (OpenBSD, FreeBSD), iOS, Android, and JavaScript. It’s great to see Nim being used on such a wide variety of platforms.
With this question, we wanted to know what operating systems are used for development.
This question also allowed multiple choices and ended up with very similar results.
You can see that Linux is also the most popular developmental platform for Nim. But it’s more popular as a target platform.
At the time of this survey, version 0.14.2 was the latest stable release.
It’s no wonder that it is the most commonly used release of Nim. It’s good to
see that the older versions are not used as often. The high use of Git HEAD (devel)
(nightly builds) isn’t surprising, Nim is still evolving rapidly and our
release schedule is not regular or frequent.
Once we go past the 1.0 release, we expect to see much less use of the unstable
devel
branch.
Despite the unstable nature of Nim in the lead up to version 1.0, whenever we make breaking changes we do our best to deprecate things and ensure that old code continues to work for our users. Of course sometimes this is not possible and other times it is simply easier to add a breaking change.
This question was asked to determine how much our user base is affected by breaking changes between Nim versions. We decided to have three possible answers for this question in order to give us an idea how frequent the breakage was.
It’s incredible to see that over 50% of our users have not experienced any breakage after upgrading. We expect this number to increase significantly after version 1.0 is released. Of the users that did experience breakage, over 80% of them said that it was a rare occurrence.
In comparison to Rust, our results show that there was a higher percentage of users experiencing breakage as a result of an upgrade. This is to be expected, because Nim is still in its pre-1.0 period, whereas Rust 1.0 has been released over a year ago now.
Unfortunately while we are still in this pre-1.0 period, releases will likely introduce breaking changes as we refine certain aspects of Nim such as its standard library, so the number of users experiencing breaking changes may increase.
Thankfully most of the breakage experienced by Nim users was very easy to fix.
Nimble is the Nim package manager, a tool that is very important in Nim’s ecosystem as it allows developers to easily install dependencies for their software.
The majority of respondents rated it as a 4, showing us that the majority does like Nimble. With over 55% rating it a 4 or 5. This percentage isn’t as overwhelming as the 94.1% of users that rated Cargo a 4 or 5 in the Rust survey. Based on these results I think that we definitely need to do a better job with Nimble.
In our next survey, it might be a good idea to ask more questions about Nimble to determine how exactly it can be improved.
We were interested to know the features of Nim that appeal most to our users. More than 80% of our respondents selected “Execution Speed” as one of the features that appeal to them. With “Development Speed” and “Readability” tying for second place and “Metaprogramming” at third place.
The options given to our respondents are rather predictable, they do show us which of these features have the highest appeal though. What’s more interesting are the “Other” answers.
By far the most popular “Other” answer was related to Nim’s compilation to C. Many users mentioned that they like how easy it is to interface with C libraries and the great portability that compiling to C offers.
It was only natural to ask this question. The results are almost perfectly opposite to the previous question’s answers, with almost 50% of respondents selecting “Debugging Tools” as the most displeasing aspect of Nim. With “Documentation” and “Testing Tools” in second and third place respectively. There is also a much larger number of “Other” answers to this question.
The “Other” answers for this question vary a lot. Here is a selection of them, ordered by frequency:
We hope that we can improve these things with time. Many of these issues are already being worked on, including the removal of the need for forward declarations. Some of these issues like our small community size are difficult to fix, but we will nonetheless do our best.
For users that have used Nim before but decided against using it, we asked just one specific question. The proportion of our respondents that answered it was 24%.
Again, this question got a lot of “Other” answers. Apart from that, the most popular reason for leaving Nim is that it is not stable. Followed by the a lack of needed libraries and packages and the instability of the standard library.
The first item, “Lack of IDE support”, was mentioned by multiple respondents. In the future we should look into ensuring that major IDEs have plugins which enable easy Nim development.
Based on some of the “Other” answers, it seems that many of the respondents have not used Nim for very long, for example many respondents complained about installation issues which they would have run into before getting a chance to use Nim. Because of this I would consider them not ex-Nim users but developers that have not had a chance to try Nim fully. Next time we should also ask how long the respondent has used Nim for to get a better idea of whether they had a chance to use Nim for extended periods of time.
We also wanted to know the reasons why developers decided against using Nim.
The most common reason that people have for not using Nim is that it is not yet ready for production. Thankfully this will improve with time. IDE support is also a prominent factor just as we’ve seen in previous results.
There is also a lot of “Other” answers, let’s have a look at a selection of them. Some of the most prominent ones, in order of frequency, include:
One respondent made a very good suggestion: they said that the “Do you use Nim?” question should have included “No, but I intend to” as an answer. Definitely something we will do in the next survey. Indeed, many respondents mentioned that they were planning on trying out Nim but that they just have no time to do so, this is very encouraging!
We wanted to get an idea of how Nim users are learning Nim. Every respondent answered this question, no matter what they answered for the “Do you use Nim?” question.
The idea behind this question was to understand which learning resources were most popular among our user base. The Nim tutorial is by far the most popular. In previous questions, we saw respondents mentioning that the Nim tutorial does not go into enough detail about Nim. Thanks to this information we can come to the conclusion that the tutorial needs to be improved significantly to make sure that it gives our users the necessary information to use Nim effectively.
Indeed, many users also use the Nim manual to learn Nim. This manual has been written as a specification and so is not ideal for teaching Nim. Many of the concepts in the Nim manual need to be explained in a lot more detail in the Nim tutorial.
Of course, it’s exciting to see our respondents using other materials to learn Nim. In particular I am excited to see that over 15% of the respondents have used Nim in Action to learn Nim. I expect that more and more users will pick up the book after it is fully published.
As the author of Nim in Action, I wanted to get some statistics surrounding my book. With this in mind, I have created some questions relating to it.
It’s good to see that over 50% of respondents have read the book or are at least planning to read it. Keep in mind that this question was answered by all respondents, not just Nim users.
.. container:: standout
Are you interested in purchasing a copy of
Nim in Action?
If so, you can use code wm090416lt
to get 50% off the printed book today only!
If you purchase it now you will get access to an early access copy of
Nim in Action in eBook form and will be able to take part in the development
of this book.
Of the people that read Nim in Action it’s nice to see that almost 70% have enjoyed it.
We were interested to know what our users believe is needed before Nim version 1.0 can be released.
It appears that the standard library is the biggest concern. With more than half of all respondents selecting “The standard library needs to reviewed and any problems with it fixed”. This is in fact something we are already planning to address, so it’s good to see that the majority agrees with us.
A large proportion of users also believes that the language is great as-is and that we should focus on stabilising the compiler. This somewhat contradicts the majority. But perhaps most of them thought that “The language” excludes the standard library.
For this question, we decided to give our respondents a dedicated place to give general feedback about what they feel is needed before v1.0 can be released. We received over 200 responses to that. Many of these responses reflect what we have already seen: that the documentation needs to improve, that we need a good Nim IDE, stability for experimental features such as concepts, the standard library needs to be cleaned up.
Unfortunately many respondents used this question to say what needs to be fixed in Nim in general, not what is definitely necessary before 1.0 can be released.
Nim users are working in a wide variety of domains. It is encouraging to see people from so many different backgrounds taking part in this survey.
Python and C are the top two programming languages that our respondents are most comfortable with. This is not altogether surprising.
At the end of the survey we gave our respondents a chance to speak their mind about anything they wish, with a simple question: “Anything else you’d like to tell us?”
There was a lot of great feedback given in this question from people who obviously really care deeply about Nim. There is too much to outline here, but rest assurred that we will take it all into account and do our best to act on it.
In addition to feedback, we were also overwhelmed by the amount of positive comments in the answers to this question. There was a lot of support from the community thanking us for our work and determination.
I’ll let some quotes speak for themselves:
You rock, seriously.
Nim rocks! Keep it up! Thank you very much!
You've made great progress on the language without any corporate backing, that is amazing. I wish Nim becomes one of the top used languages in a few years.
Nim is elegant and wonderful! Keep at it!
Our community is truly brilliant. We thank each and every one of you for filling out this survey and hope that you will help us tackle some of the challenges that face Nim.
This survey was a good place to give us feedback, but please don’t wait for the next one. We are always looking to hear more from you and we hope that you will participate in discussions relating to this survey as well the future of Nim.
Thanks for reading, and have a good day!
This was cross-posted from update #4 on BountySource.
We are now in the fourth month of the Nim BountySource fundraiser and here is this month’s update[1]. Once again this month, we have beat our previous donation record of $1280 having raised over $1600 over the course of July! That’s now 4 months in a row that your monthly donations have been increasing. As always we are absolutely blown away by your contributions, myself and the rest of the Nim team are extremely thankful for them. It’s not only helping us pay for the necessary expenses (like for example the server that http://nim-lang.org runs on) but it also inspires us to keep going and to make Nim the best programming language that it can be.
As mentioned in last month’s update, we have begun the process of engaging with the Nim community through a survey. This survey has now been open for more than a month and will be closing very soon (in about 2 days), so if you haven’t answered it yet, now would be a perfect time to do so. You can find the survey here: http://nim-lang.org/survey.
The survey itself has been designed for three types of people: Nim users, ex-Nim users and people who have never used Nim before. This means that you have no excuse not to answer it[2]. There are almost 700 submissions and after the survey is finalised, a blog post will be written with a thorough analysis.
It is my hope that the survey analysis will give the Nim team a good idea of what needs to be implemented before version 1.0 can be released. Personally, I hope to make a thorough review of the standard library to ensure that it is ready for the “1.0 backwards compatibility lock”[3]. Although I myself have been very busy lately[4], Araq has been working very hard to fix High Priority issues, ahead of the 1.0 release. And as always, there has also been a lot of pull requests from a wide range of Nim users.
Lastly, I would like to mention Nim in Action once again. I have recently finished the final chapter. All that remains now are corrections (based mainly on your feedback, huge thanks to everyone for reading!) and a final review. The book will then be put into production[5] with an estimated print date of around the 20th of January (as usual delays are very much possible). If you have not yet picked up the book, now would be a perfect time to do so. There is still time for you to give feedback about the book, and for me to improve it based on your remarks. It is not often that you can influence a book in this way, and it is my hope that you will help me make this book one of the best resources for learning Nim!
As always, many thanks for reading and if you have any questions or feedback feel free to get in touch via email at [email protected] or via Twitter.
1 - These updates have so far been fairly regular and it is my hope to write at least one a month. Yep, I am patting myself on the back :)
2 - I joke of course, don’t worry about if you don’t have the time :)
3 - After version 1.0, it is typical for a piece of software (especially a programming language) to ensure that backwards compatibility is not broken between further minor versions until a new major version such as 2.0 is released.
4 - Writing a book, moving to Switzerland to start a new job, and playing Pokemon Go has certainly kept me busy.
5 - Basically the brilliant guys at Manning will process the book so that it looks good in a printed format.
We are proud to announce the official 2016 Nim Community Survey! No matter whether you use Nim today, have used Nim previously, or never used Nim before; we want to know your opinions. Your feedback will help the Nim project understand its strengths and weaknesses, and to determine development priorities for the future.
It shouldn’t take you much longer than 5 to 10 minutes to complete this survey. Submissions will be accepted until around the 23rd of July, depending on the response rates. If you have any questions or feedback, please don’t hesitate to get in touch with us via email at [email protected] or on the Nim Forum.
We would appreciate your help in spreading the word about this survey. Share the above link on your social network feeds, with your colleagues and in other communities.
Thank you to everyone that helped develop and test the survey! Once the submission period ends, the results will be shown here and publicised via Twitter, the Nim Forum and IRC.
Thanks for your time!
Version 0.14.2 is just a bugfix release that fixes the most pressing
regressions. In particular, the tar.xz
now supports documentation
generation, and the Windows installers bundle the latest stable nimble
release.
The news about the 0.14.0 release are still relevant, so check them out here.
It’s been a while since the last release, but we’ve been very busy in the meantime. In addition to working on Nim we have started a BountySource campaign and announced the pre-release of a new Nim book titled Nim in Action. Our BountySource campaign has already been very successful, helping us raise enough funds to surpass 4 of our monthly goals. The companies and individuals that made this possible are listed on our brand new sponsors page.
This release includes over 260 bug fixes. As mentioned in the previous release announcement, one of the focuses of this release was going to be improvements to the GC. Indeed, the most prominent fixes are related to the GC not collecting cycles properly. This was a major problem that was triggered typically when applications using asynchronous I/O were left running for long periods of time.
There have also been many fixes to the way that the compiler sources are installed. Some applications such as Nimble depend on these sources and they are now included in the release tarballs. This should fix many of the problems that users experienced trying to compile the Nimble package manager.
Finally, you will find multiple changes in the standard library. Some of which
unfortunately affects backwards compatibility. This includes the random
procedures being moved to a new random
module, HTTP headers being stored
in a new HttpHeaders
object and the round
procedure in the math
module
being changed to return a float
instead of an int
. You can find a full
list of such changes below.
Together with the new release of Nim, we are also releasing a new version of Nimble. The release notes for it are available on GitHub.
As always you can download the latest version of Nim from the download page.
We hope that you will like this new release. Let us know if you run into any trouble, have any questions or want to give some feedback. You can get in touch with us on the Forum, IRC, Twitter, or via email [email protected].
Happy coding!
--out
and --nimcache
command line arguments are now relative to
current directory. Previously they were relative to project directory.fields*: Table[string, JsonNode]
instead of a
sequence. This means that order is no longer preserved. When using the
table.mpairs
iterator only the returned values can be modified, no
longer the keys.#!
was removed from the language. Use #?
instead.using
.mersenne.nim
(Mersenne Twister implementation) no longer
accept and produce int
values which have platform-dependent size -
they use uint32
instead.strutils.unindent
procedure has been rewritten. Its parameters now
match the parameters of strutils.indent
. See issue #4037.
for more details.matchers
module has been deprecated. See issue #2446
for more details.json.[]
no longer returns nil
when a key is not found. Instead it
raises a KeyError
exception. You can compile with the -d:nimJsonGet
flag to get a list of usages of []
, as well as to restore the operator’s
previous behaviour.useMalloc
, an additional header containing the size of the
allocation will be allocated, to support zeroing memory on realloc as expected
by the language. With this change, alloc
and dealloc
are no longer
aliases for malloc
and free
- use c_malloc
and c_free
if
you need that.json.%
operator is now overloaded for object
, ref object
and
openarray[T]
.random
number generation in math.nim
have
been moved to its own random
module and been reimplemented in pure
Nim.--path:"$projectdir"
. (The compiler
replaces $projectdir
with your project’s absolute directory when compiling,
so you don’t need to replace $projectdir
by your project’s actual
directory!). See issue #546
and this forum thread for more
information.round
function in math.nim
now returns a float and has been
corrected such that the C implementation always rounds up from .5 rather
than changing the operation for even and odd numbers.round
function now accepts a places
argument to round to a
given number of places (e.g. round 4.35 to 4.4 if places
is 1).strutils.nim
, formatSize
now returns a number representing the
size in conventional decimal format (e.g. 2.234GB meaning 2.234 GB rather
than meaning 2.285 GB as in the previous implementation). By default it
also uses IEC prefixes (KiB, MiB) etc and optionally uses colloquial names
(kB, MB etc) and the (SI-preferred) space.==
operator for cstring
now implements a value comparison
for the C backend (using strcmp
), not reference comparisons anymore.
Convert the cstrings to pointers if you really want reference equality
for speed.HttpHeaders
object instead of a
StringTableRef
. This object allows multiple values to be associated with
a single key. A new httpcore
module implements it and it is used by
both asynchttpserver
and httpclient
.using
statementThe using
statement now has a different meaning.
In version 0.13.0, it was used to provide syntactic convenience for procedures that heavily use a single contextual parameter. For example:
var socket = newSocket()
using socket
connect("google.com", Port(80))
send("GET / HTTP/1.1\c\l")
The connect
and send
calls are both transformed so that they pass
socket
as the first argument:
var socket = newSocket()
socket.connect("google.com", Port(80))
socket.send("GET / HTTP/1.1\c\l")
Take a look at the old version of the manual to learn more about the old behaviour.
In 0.14.0,
the using
statement
instead provides a syntactic convenience for procedure definitions where the
same parameter names and types are used repeatedly. For example, instead of
writing:
proc foo(c: Context; n: Node) = ...
proc bar(c: Context; n: Node, counter: int) = ...
proc baz(c: Context; n: Node) = ...
You can simply write:
{.experimental.}
using
c: Context
n: Node
counter: int
proc foo(c, n) = ...
proc bar(c, n, counter) = ...
proc baz(c, n) = ...
Again, the manual has more details.
You can still achieve a similar effect to what the old using
statement
tried to achieve by using the new experimental this
pragma, documented
here.
Generic type classes are now handled properly in the compiler, but this means code like the following does not compile any longer:
type
Vec3[T] = distinct array[3, T]
proc vec3*[T](a, b, c: T): Vec3[T] = Vec3([a, b, c])
While every Vec3[T]
is part of the Vec3
type class, the reverse
is not true, not every Vec3
is a Vec3[T]
. Otherwise there would
be a subtype relation between Vec3[int]
and Vec3[float]
and there
is none for Nim. The fix is to write this instead:
type
Vec3[T] = distinct array[3, T]
proc vec3*[T](a, b, c: T): Vec3[T] = Vec3[T]([a, b, c])
Note that in general we don’t advise to use distinct array
,
use object
instead.
&=
has been added to the
system
and the net
modules. This operator is similar to the C++
<<
operator which writes data to a stream.strscans
module that implements a scanf
for easy input extraction.parseutils.parseUntil
that can deal with a string
until
token. The other versions are for char
and set[char]
.splitDecimal
to math.nim
to split a floating point value
into an integer part and a floating part (in the range -1<x<1).trimZeros
to strutils.nim
to trim trailing zeros in a
floating point number.formatEng
to strutils.nim
to format numbers using engineering
notation.--noCppExceptions
switch that allows to use default exception
handling (no throw
or try
/catch
generated) when compiling to C++
code..this
pragma for more notational convenience.
See automatic-self-insertions for more information.using
statement for more convenience.
Consult using-statement for more information.include
statements are not restricted to top level statements anymore...
partial
object declarations to mitigate the problems
that arise when types are mutually dependent and yet should be kept in
different modules.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 “Using break inside iterator may produce memory/resource leak” (#3802)
..<
is not happy with BiggestInt
from intVal
”
(#3767)Fixed “Tests regressions while using the devel branch” (#4005)
&
operator mutates first operand when used in compileTime proc while assigning result to seq”
(#3804)mitems
or mpairs
does not work for seq[NimNode]
or array[T,NimNode]
in a macro”
(#3859),
()” to nim check causes an infinite loop”
(#4036)Fixed “$
For array crashes the compiler when assigned to const”
(#4040)
Fixed “Rationals Overflow Error on 32-bit machine” (#4194)
unlikely
/likely
should be no-ops for the Javascript backend”
(#3882)asynchttpserver
support request-body when put
delete
?”
(#4221)Fixed “asynchttpserver may consume unbounded memory reading headers” (#3847)
Once again we are proud to announce the latest release of the Nim compiler and related tools. This release comes just 3 months after the last release!
A new version of Nimble which depends on this release, has also been released. See this forum thread for more information about the Nimble release.
This release of Nim includes over 116 bug fixes, many of which are related to closures. The lambda lifting algorithm in the compiler has been completely rewritten, and some changes have been made to the semantics of closures in Nim as a result. These changes may affect backwards compatibility and are all described in the section below.
With this release, we are one step closer to Nim version 1.0. The 1.0 release will be a big milestone for Nim, because after that version is released there will be no more breaking changes made to the language or the standard library.
That being said, the next release will likely be Nim 0.14. It will focus on improvements to the GC and concurrency. We will in particular be looking at ways to add multi-core support to async await. Standard library improvements are also on our roadmap but may not make it for Nim 0.14.
As always you can download the latest version of Nim from the download page.
Happy coding!
macros.newLit
for bool
now produces false/true symbols which
actually work with the bool datatype.Node
, NodeType
and Document
are no longer
defined. Use the types defined in dom.nim
instead.x is iterator
(used for instance in concepts) was always a
weird special case (you could not use x is proc
) and was removed from
the language.closure
anymore.redis
module has been moved out of the standard library. It can
now be installed via Nimble and is located here:
https://github.com/nim-lang/redismath.RunningStat
and its associated procs have been moved from
the math
module to a new stats
module.The parser now considers leading whitespace in front of operators
to determine if an operator is used in prefix or infix position.
This means that finally echo $foo
is parsed as people expect,
which is as echo($foo)
. It used to be parsed as (echo) $ (foo)
.
echo $ foo
continues to be parsed as (echo) $ (foo)
.
This also means that -1
is always parsed as prefix operator so
code like 0..kArraySize div 2 -1
needs to be changed to
0..kArraySize div 2 - 1
.
This release also adds multi-line comments to Nim. The syntax for them is:
#[ comment here ]#
. For more details read the section of
the manual.
Implicit return type inference for iterators has been removed from the language. The following used to work:
iterator it =
yield 7
This was a strange special case and has been removed. Now you need to write it like so which is consistent with procs:
iterator it: auto =
yield 7
The semantics of closures changed: Capturing variables that are in loops do not produce a new environment. Nim closures behave like JavaScript closures now.
The following used to work as the environment creation used to be attached to the loop body:
proc outer =
var s: seq[proc(): int {.closure.}] = @[]
for i in 0 ..< 30:
let ii = i
s.add(proc(): int = return ii*ii)
This behaviour has changed in 0.13.0 and now needs to be written as:
proc outer =
var s: seq[proc(): int {.closure.}] = @[]
for i in 0 ..< 30:
(proc () =
let ii = i
s.add(proc(): int = return ii*ii))()
The reason is that environment creations are now only performed once per proc call. This change is subtle and unfortunate, but:
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.
excl
cause SIGSEGV”
(#3639)In case you have missed it, here is Andreas’ Nim: An Overview talk at OSCON Amsterdam.
The Nim community of developers is proud to announce the new version of the Nim compiler. This has been a long time coming as the last release has been made over 5 months ago!
This release includes some changes which affect backwards compatibility,
one major change is that now the hash table []
operators now raise a
KeyError
exception when the key does not exist.
Some of the more exciting new features include: the ability to unpack tuples in any assignment context, the introduction of NimScript, and improvements to the type inference of lambdas.
There are of course many many many bug fixes included with this release. We are getting closer and closer to a 1.0 release and are hoping that only a few 0.x releases will be necessary before we are happy to release version 1.0.
As always you can download the latest version of Nim from the download page.
For a more detailed list of changes look below. Some of the upcoming breaking changes are also documented in this forum thread.
re
and nre
now depend on version
8.36 of PCRE. If you have an older version you may see a message similar
to could not import: pcre_free_study
output when you start your
program. See this issue
for more information.tables.[]
, strtabs.[]
, critbits.[]
now raise
the KeyError
exception when the key does not exist! Use the
new getOrDefault
instead to get the old behaviour. Compile all your
code with -d:nimTableGet
to get a listing of where your code
uses []
!rawsockets
module has been renamed to nativesockets
to avoid
confusion with TCP/IP raw sockets, so newNativeSocket
should be used
instead of newRawSocket
.miliseconds
property of times.TimeInterval
is now milliseconds
.
Code accessing that property is deprecated and code using miliseconds
during object initialization or as a named parameter of initInterval()
will need to be updated.std.logging
functions no longer do formatting and semantically treat
their arguments just like echo
does. Affected functions: log
,
debug
, info
, warn
, error
, fatal
. Custom subtypes of
Logger
also need to be adjusted accordingly.2d
(float64)
and 2f
(float32) which means imports like import scene/2d/sprite
do not work anymore. Instead quotes have to be
used: import "scene/2d/sprite"
. The former code never was valid Nim.windows.nim
) is now not part of the official
distribution anymore. Instead use the oldwinapi
Nimble package.--os:standalone
and --gc:none
. So if you use --os:standalone
ensure you also use
--gc:none
. --os:standalone
without --gc:none
is now a version
that doesn’t depend on any OS but includes the GC. However this version
is currently untested!Socket
/AsyncSocket
now need to
specify the socket domain, type and protocol. The param name
typ: SockType
(in newSocket
/newAsyncSocket
procs) was also
renamed to sockType
. The param af
in the connect
procs was
removed. This affects asyncnet
, asyncdispatch
, net
, and
rawsockets
.varargs[typed]
and varargs[untyped]
have been refined and now work
as expected. However varargs[untyped]
is not an alias anymore for
varargs[expr]
. So if your code breaks for varargs[untyped]
, use
varargs[expr]
instead. The same applies to varargs[typed]
vs
varargs[stmt]
.sequtils.delete
doesn’t take confusing default arguments anymore.system.free
was an error-prone alias to system.dealloc
and has
been removed.macros.high
never worked and the manual says high
cannot be
overloaded, so we removed it with no deprecation cycle.parallel
statement you now have to
use the --experimental
mode.closure
never worked reliably
and are now deprecated and will be removed from the language. Instead you
have to insert type conversions
like (proc (a, b: int) {.closure.})(myToplevelProc)
if necessary.libffi
, sdl
, windows
, zipfiles
, libzip
,
zlib
, zzip
, dialogs
, expat
, graphics
, libcurl
,
sphinx
have been moved out of the stdlib and are Nimble packages now.The constant fights between 32 and 64 bit DLLs on Windows have been put to an end: The standard distribution now ships with 32 and 64 bit versions of all the DLLs the standard library needs. This means that the following DLLs are now split into 32 and 64 versions:
pcre.dll
: Split into pcre32.dll
and pcre64.dll
.pdcurses.dll
: Split into pdcurses32.dll
and pdcurses64.dll
.sqlite3.dll
: Split into sqlite3_32.dll
and sqlite3_64.dll
.ssleay32.dll
: Split into ssleay32.dll
and ssleay64.dll
.libeay32.dll
: Split into libeay32.dll
and libeay64.dll
.Compile with -d:nimOldDLLs
to make the stdlib use the old DLL names.
nkObjConstr
nodes, and not nkPar
nodes
as it was previously. Macros that generate nkPar
nodes when object is
expected are likely to break. Macros that expect nkPar
nodes to which
objects are passed are likely to break as well.base
pragma. This makes
multi methods less error-prone to use with the effect system.#!
is now #?
in order to produce no conflicts
with Unix’s #!
.auto
if
you want more type inference.The type auto
is now a “multi-bind” metatype, so the following compiles:
proc f(x, y: auto): auto =
result = $x & y
echo f(0, "abc")
ftpclient
module is now deprecated in favour of the
asyncftpclient
module.repeat
function to cycle
(concatenating
a sequence by itself the given times), and also introduced repeat
,
which repeats an element the given times.map
is moved to sequtils.nim. The inplace map
version
is renamed to apply
.mapIt
now doesn’t require the result’s type parameter.
Also the inplace mapIt
is renamed to apply
.The compiler is now stricter with what is allowed as a case object discriminator. The following code used to compile but was not supported completely and so now fails:
type
DataType* {.pure.} = enum
Char = 1,
Int8 = 2,
Int16 = 3,
Int32 = 4,
Int64 = 5,
Float32 = 6,
Float64 = 7
DataSeq* = object
case kind* : DataType
of DataType.Char: charSeq* : seq[char]
of DataType.Int8: int8Seq* : seq[int8]
of DataType.Int16: int16Seq* : seq[int16]
of DataType.Int32: int32Seq* : seq[int32]
of DataType.Int64: int64Seq* : seq[int64]
of DataType.Float32: float32Seq* : seq[float32]
of DataType.Float64: float64Seq* : seq[float64]
length* : int
expandSymlink
proc has been added to the os
module.tailDir
proc has been added to the os
module.nimPinToCpu
to make the threadpool
use explicit thread
affinities. This can speed up or slow down the thread pool; it’s up to you
to benchmark it.strutils.formatFloat
and formatBiggestFloat
do not depend on the C
locale anymore and now take an optional decimalSep = '.'
parameter.unicode.lastRune
, unicode.graphemeLen
.[]
, []=
, {}
, {}=
operators
(issue #2599).--reportConceptFailures
switch for better debugging of
concept related type mismatches. This can also be used to debug
system.compiles
failures.system.unsafeAddr
can be used to access the address of a let
variable or parameter for C interoperability. Since technically this
makes parameters and let
variables mutable, it is considered even more
unsafe than the ordinary addr
builtin.macros.getImpl
that can be used to access the implementation of
a routine or a constant. This allows for example for user-defined inlining
of function calls.(x, y) = f()
is allowed. Note that this doesn’t declare x
and y
variables, for
this let (x, y) = f()
still needs to be used.when nimvm
can now be used for compiletime versions of some code
sections. Click here for details.NimNode
in a proc now implicitly annotates the proc
with .compileTime
. This means generics work much better for NimNode
.Fixed “[JS][Codegen] Initialising object doesn’t create unmentioned fields.”
(#2617)
repr
-ing a type directly”
(#3079)static[T]
in sequences”
(#3144)repr
cstring”
(#3080)createU
fails to compile”
(#3193)This is just a bugfix release that fixes the most pressing regressions we introduced with version 0.11.0. The way types are computed was changed significantly causing all sort of problems. Sorry for the inconvenience; we grew overconfident our large test suite would prevent these things.
With this release we are one step closer to reaching version 1.0 and by extension the persistence of the Nim specification. As mentioned in the previous release notes, starting with version 1.0, we will not be introducing any more breaking changes to Nim.
The language itself is very close to 1.0, the primary area that requires more work is the standard library.
Take a look at the download page for binaries (Windows-only) and 0.11.0 snapshots of the source code. The Windows installer now also includes Aporia, Nimble and other useful tools to get you started with Nim.
The 1.0 release is expected by the end of this year. Rumors say it will be in summer 2015. What’s left:
concept
needs to be refined, a nice name for the feature is not enough.static[T]
needs to be fixed.immediate
templates and macros will be deprecated as these will soon be
completely unnecessary, instead the typed
or untyped
metatypes can
be used.Parameter names are finally properly gensym
‘ed. This can break
templates though that used to rely on the fact that they are not.
(Bug #1915.) This means this doesn’t compile anymore:
template doIt(body: stmt) {.immediate.} =
# this used to inject the 'str' parameter:
proc res(str: string) =
body
doIt:
echo str # Error: undeclared identifier: 'str'
This used to inject the str
parameter into the scope of the body.
Declare the doIt
template as immediate, dirty
to get the old
behaviour.
logging.level
and logging.handlers
are no longer exported.
addHandler
, getHandlers
, setLogFilter
and getLogFilter
should be used instead.nim idetools
has been replaced by a separate
tool nimsuggest.->
, ~>
or
=>
, not just >
. Examples of operators still considered arrow like:
->
, ==>
, +=>
. On the other hand, the following operators are now
considered regular operators again: |>
, -+>
, etc.type(x).name
is now parsed as (type(x)).name
and not as type((x).name)
. Note that this also affects the AST
structure; for immediate macro parameters nkCall('addr', 'x')
is
produced instead of nkAddr('x')
.concept
is now a keyword and is used instead of generic
.The inc
, dec
, +=
, -=
builtins now produce OverflowError
exceptions. This means code like the following:
var x = low(T)
while x <= high(T):
echo x
inc x
Needs to be replaced by something like this:
var x = low(T).int
while x <= high(T).int:
echo x.T
inc x
a[0.. -1]
you can
use a[0.. ^1]
. This also works with accessing a single
element a[^1]
. Note that we cannot detect this reliably as it is
determined at runtime whether negative indexing is used!
a[0.. -1]
now produces the empty string/sequence.foo +=1
which uses inconsistent
spacing around binary operators. Later versions of the language will parse
these as unary operators instead so that echo $foo
finally can do what
people expect it to do.system.untyped
and system.typed
have been introduced as aliases
for expr
and stmt
. The new names capture the semantics much better
and most likely expr
and stmt
will be deprecated in favor of the
new names.split
method in module re
has changed. It now handles the case
of matches having a length of 0, and empty strings being yielded from the
iterator. A notable change might be that a pattern being matched at the
beginning and end of a string, will result in an empty string being produced
at the start and the end of the iterator.case object
branches discard
can finally be used instead
of nil
.Objects that do not use inheritance nor case
can be put into const
sections. This means that finally this is possible and produces rather
nice code:
import tables
const
foo = {"ah": "finally", "this": "is", "possible.": "nice!"}.toTable()
Ordinary parameters can follow after a varargs parameter. This means the following is finally accepted by the compiler:
template takesBlock(a, b: int, x: varargs[expr]; blck: stmt) =
blck
echo a, b
takesBlock 1, 2, "some", 0.90, "random stuff":
echo "yay"
Overloading by ‘var T’ is now finally possible:
proc varOrConst(x: var int) = echo "var"
proc varOrConst(x: int) = echo "const"
var x: int
varOrConst(x) # "var"
varOrConst(45) # "const"
^
operator to access
things from backwards: a[^1]
is like Python’s a[-1]
.system.len
for strings and sequences now returns 0 for nil.
A single underscore can now be used to discard values when unpacking tuples:
let (path, _, _) = os.splitFile("path/file.ext")
marshal.$$
and marshal.to
can be executed at compile-time.macros.getType
can be used to query an AST’s type at compile-time. This
enables more powerful macros, for instance currying can now be done with
a macro.reversed
proc added to the unicode
module.post
and postContent
together
with a newMultipartData
proc.%*
operator for JSON...^
and ..<
templates to system so that the rather annoying
space between .. <
and .. ^
is not necessary anymore.system.xlen
for strings and sequences to get back the old len
operation that doesn’t check for nil
for efficiency.char()
in an echo call
(#1788).static[int]
param
(#1056).channels.tryRecv
blocking
(#1816).typedesc
(#419).static[T]
in a specific
way (#1049).uri
module.nil
can now be inserted into tables with the db_sqlite
module
(#1866).noSideEffect
not affected by echo
”
(#2011)\0
”
(#2124)fieldPairs
doesn’t work inside templates”
(#1902)const
”
(#1940)<
, items
, or arrays”
(#2287)method
: 1 in a objects constructor fails when compiling”
(#1791)This release marks the completion of a very important change to the project: the official renaming from Nimrod to Nim. Version 0.10.2 contains many language changes, some of which may break your existing code. For your convenience, we added a new tool called nimfix that will help you convert your existing projects so that it works with the latest version of the compiler.
Although Nim is still pre-1.0, we were able to keep the number of breaking
changes to a minimum so far. Starting with version 1.0, we will not introduce
any breaking changes between major release versions.
One of Nim’s goals is to ensure that the compiler is as efficient as possible.
Take a look at the
latest benchmarks,
which show that Nim is consistently near
the top and already nearly as fast as C and C++. Recent developments, such as
the new asyncdispatch
module will allow you to write efficient web server
applications using non-blocking code. Nim now also has a built-in thread pool
for lightweight threading through the use of spawn
.
The unpopular “T” and “P” prefixes on types have been deprecated. Nim also
became more expressive by weakening the distinction between statements and
expressions. We also added a new and searchable forum, a new website, and our
documentation generator docgen
has seen major improvements. Many thanks to
Nick Greenfield for the much more beautiful documentation!
The 1.0 release is actually very close. Apart from bug fixes, there are two major features missing or incomplete:
static[T]
needs to be defined precisely and the bugs in the
implementation need to be fixed.This means that fancy matrix libraries will finally start to work, which used to be a major point of pain in the language.
Outside of the language and the compiler itself many Nim tools have seen considerable improvements.
Babel the Nim package manager has been renamed to Nimble. Nimble’s purpose is the installation of packages containing libraries and/or applications written in Nim. Even though Nimble is still very young it already is very functional. It can install packages by name, it does so by accessing a packages repository which is hosted on a GitHub repo. Packages can also be installed via a Git repo URL or Mercurial repo URL. The package repository is searchable through Nimble. Anyone is free to add their own packages to the package repository by forking the nim-lang/packages repo and creating a pull request. Nimble is fully cross-platform and should be fully functional on all major operating systems. It is of course completely written in Nim.
nimrod
to nim
too.system.fileHandle
has been renamed to system.getFileHandle
to
prevent name conflicts with the new type FileHandle
.discard
.var foo: Foo
in more contexts.object
instead.nil
instead of ""
when an optional capture
fails to match.nil
instead of ""
when an optional capture
fails to match.-+-
) never worked and has been
removed.defer
is a keyword now.func
is a keyword now.using
language feature now needs to be activated via the new
{.experimental.}
pragma that enables experimental language features.except
and finally
statements are deprecated now.
The standalone finally
can be replaced with defer
,
standalone except
requires an explicit try
.>
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.do
block anymore. This
means the confusing nnkDo
nodes when working with macros are gone for
good.locks
sections,
lock levels and object field guards
.parallel
statement has been implemented.deepCopy
has been added to the language.procCall
can be used to get super
-like functionality
for multi methods.{.experimental.}
that enables experimental
language features per module, or you can enable these features on a global
level with the --experimental
command line option.importCpp
or importObjc
are compiled to C++
or Objective C code, any other module is compiled to C code. This
improves interoperability.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
emit
or asm
statement.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.future
module.asyncnet
) now supports SSL.smtp
module now has an async implementation.asyncfile
which implements asynchronous file reading
and writing.osproc.kill
has been added.asyncnet
and asynchttpserver
now support SO_REUSEADDR
.nil
and NULL
are now preserved between Nim and databases in the
db_*
modules.x.low
(#1366).asynchttpserver
fixes.osproc
fixes on Windows.osproc.terminate
fixed.try
now works at compile-time.T = ref T
to be an illegal recursive type.math
module on Windows.A brand new website including an improved forum is now live. All thanks go to Philip Witte and Dominik Picheta, Philip Witte for the design of the website (together with the logo) as well as the HTML and CSS code for his template, and Dominik Picheta for integrating Philip’s design with Nim’s forum. We’re sure you will agree that Philip’s design is beautiful.
Note: 0.9.6 is the last release of Nimrod. The language is being renamed to Nim. Nim slightly breaks compatibility.
This is a maintenance release. The upcoming 0.10.0 release has the new features and exciting developments.
spawn
now uses an elaborate self-adapting thread pool and as such
has been moved into its own module. So to use it, you now have to import
threadpool
.bar
in foo.bar
is
now considered for implicit early binding.c2nim
moved into its own repository and is now a Babel package.pas2nim
moved into its own repository and is now a Babel package.system.$
for floating point types now produces a human friendly string
representation.uri.TUrl
as well as the parseurl
module are now deprecated in favour
of the new TUri
type in the uri
module.destructor
pragma has been deprecated. Use the override
pragma
instead. The destructor’s name has to be destroy
now.lambda
is not a keyword anymore.--symbol
to declare new conditional symbols that can be
set via --define
.--threadanalysis:on
is now the default. To make your program compile
you can disable it but this is only a temporary solution as this option
will disappear soon!deprecated
pragma statement that is used
to handle the upcoming massive amount of symbol renames.spawn
can now wrap proc that has a return value. It then returns a data
flow variable of the wrapped return type.cpuinfo
.threadpool
.sequtils.distnct
has been renamed to sequtils.deduplicate
.algorithm.reversed
uri.combine
and uri.parseUri
.SafeDisconn
flag which causes
them to handle disconnection errors and not raise them.The Nimrod development community is proud to announce the release of version 0.9.4 of the Nimrod compiler and tools. Note: This release has to be considered beta quality! Lots of new features have been implemented but unfortunately some do not fulfill our quality standards yet.
Prebuilt binaries and instructions for building from source are available on the download page.
This release includes about 1400 changes in total including various bug fixes, new languages features and standard library additions and improvements. This release brings with it support for user-defined type classes, a brand new VM for executing Nimrod code at compile-time and new symbol binding rules for clean templates.
It also introduces support for the brand new Babel package manager which has itself seen its first release recently. Many of the wrappers that were present in the standard library have been moved to separate repositories and should now be installed using Babel.
Apart from that a new experimental Asynchronous IO API has been added via
the asyncdispatch
and asyncnet
modules. The net
and rawsockets
modules have also been added and they will likely replace the sockets
module in the next release. The Asynchronous IO API has been designed to
take advantage of Linux’s epoll and Windows’ IOCP APIs, support for BSD’s
kqueue has not been implemented yet but will be in the future.
The Asynchronous IO API provides both
a callback interface and an interface which allows you to write code as you
would if you were writing synchronous code. The latter is done through
the use of an await
macro which behaves similar to C#’s await. The
following is a very simple chat server demonstrating Nimrod’s new async
capabilities.
import asyncnet, asyncdispatch
var clients: seq[PAsyncSocket] = @[]
proc processClient(client: PAsyncSocket) {.async.} =
while true:
let line = await client.recvLine()
for c in clients:
await c.send(line & "\c\L")
proc serve() {.async.} =
var server = newAsyncSocket()
server.bindAddr(TPort(12345))
server.listen()
while true:
let client = await server.accept()
clients.add client
processClient(client)
serve()
runForever()
Note that this feature has been implemented with Nimrod’s macro system and so
await
and async
are no keywords.
Syntactic sugar for anonymous procedures has also been introduced. It too has been implemented as a macro. The following shows some simple usage of the new syntax:
import future
var s = @[1, 2, 3, 4, 5]
echo(s.map((x: int) => x * 5))
A list of changes follows, for a comprehensive list of changes take a look here.
macros.genSym
builtin for AST generation.macros.newLit
procs for easier AST generation.logging
.asyncdispatch
.asyncnet
.net
.rawsockets
.selectors
.asynchttpserver
.httpclient
module.future
module that features upcoming additions
to the system
module.if
statement changed for better interaction
with the new syntactic construct (;)
.OSError
family of procedures has been deprecated. Procedures with the same
name but which take different parameters have been introduced. These procs now
require an error code to be passed to them. This error code can be retrieved
using the new OSLastError
proc.os.parentDir
now returns “” if there is no parent dir.cgi.setStackTraceStdout
is used.bind
for any
symbol that’s not a parameter is now the default. mixin
can be used
to require instantiation scope for a symbol.quoteIfContainsWhite
now escapes argument in such way that it can be safely
passed to shell, instead of just adding double quotes.macros.dumpTree
and macros.dumpLisp
have been made immediate
,
dumpTreeImm
and dumpLispImm
are now deprecated.nil
statement has been deprecated, use an empty discard
instead.sockets.select
now prunes sockets that are not ready from the list
of sockets given to it.noStackFrame
pragma has been renamed to asmNoStackFrame
to
ensure you only use it when you know what you’re doing.{.warning[Uninit]:on.}
.not nil
constraint.codegenDecl
pragma for even more control
over the generated code.computedGoto
pragma to support very fast
dispatching for interpreters and the like.nimrod i
and for macro
evaluation.--gc:none
produces warnings when code uses the GC.union
pragma for better C interoperability is now supported.packed
pragma to control the memory packing/alignment of fields in
an object.unchecked
for easier low level
manipulations of memory.N
instead of a
range; the range is then 0..N-1
.requiresInit
pragma to enforce explicit initialization.using statement
enables you to more easily author domain-specific
languages and libraries providing OOP-like syntactic sugar.static[T]
params that must be
evaluable at compile-time.strongSpaces
parsing mode has been implemented.spawn
for easy thread pool usage.--cpp
command line option
to activate.Nimrod has been featured as the cover story in the February 2014 issue of Dr. Dobb’s Journal.
Andreas Rumpf presented Nimrod: A New Approach to Metaprogramming at Strange Loop 2013. The video and slides of the talk are now available.
We are pleased to announce that version 0.9.2 of the Nimrod compiler has been released. This release has attracted by far the most contributions in comparison to any other release.
This release brings with it many new features and bug fixes, a list of which
can be seen later. One of the major new features is the effect system together
with exception tracking which allows for checked exceptions and more,
for further details check out the manual .
Another major new feature is the introduction of statement list expressions,
more details on these can be found here.
The ability to exclude symbols from modules has also been
implemented, this feature can be used like so: import module except symbol
.
Thanks to all contributors!
GC_disableMarkAndSweep
and run it explicitly at an appropriate time
or not at all. There is also a new GC you can activate
with --gc:markAndSweep
which does not have this problem but is slower in
general and has no realtime guarantees.cast
for floating point types now does the bitcast as specified in the
manual. This breaks code that erroneously uses cast
to convert different
floating point values.--gc:markAndSweep
.system.onRaise
to support a condition system.system.locals
that provides access to a proc’s locals.macros.quote
for AST quasi-quoting.system.unsafeNew
to support hacky variable length objects.system.fields
and system.fieldPairs
support object
too; they
used to only support tuples.system.CurrentSourcePath
returning the full file-system path of
the current source file.macros
module now contains lots of useful helpers for building up
abstract syntax trees.shared
is a keyword now.sockets.recvLine
and asyncio.recvLine
, added
readLine
instead.scgi
module.doc2
command does not generate output for the whole project anymore.
Use the new --project
switch to enable this behaviour.--warning[ShadowIdent]:on
.push
pragma.noforward
pragma enabling a special
compilation mode that largely eliminates the need for forward declarations.case expressions
are now supported.case
statement.mixin
declaration to affect symbol binding rules in generics.doc2
command annotates possible
exceptions for you.doc2
command annotates possible tags for you.not nil
to explicitly state
that nil
is not allowed. However currently the compiler performs no
advanced static checking for this; for now it’s merely for documentation
purposes.export
statement has been added to the language: It can be used for
symbol forwarding so client modules don’t have to import a module’s
dependencies explicitly.(;)
unifying expressions and
statements.from module import nil
if you want to import the module
but want to enforce fully qualified access to every symbol in module
.if
statements will change in 0.9.4. This affects the
=~
pegs/re templates.sockets
module will become a low-level wrapper of OS-specific socket
functions. All the high-level features of the current sockets
module
will be moved to a network
module.case
statements.algorithm.sort
to
produce segmentation faults.\r\L
was
indistinguishable from disconnections.htmlgen
to the documentation.cookies
to the documentation.system.shallow
that can be used to speed up string and sequence
assignments.system.eval
that can execute an anonymous block of code at
compile time as if was a macro.system.staticExec
and system.gorge
for compile-time execution
of external programs.system.staticRead
as a synonym for system.slurp
.macros.emit
that can emit an arbitrary computed string as nimrod
code during compilation.strutils.parseEnum
.json.%
constructor operator.oids
.endians
.libsvm
.mongodb
.terminal.isatty
.system.items
that can be used to iterate over the
values of an enum.system.TInteger
and system.TNumber
type classes matching
any of the corresponding types available in Nimrod.system.clamp
to limit a value within an interval [a, b]
.strutils.continuesWith
.system.getStackTrace
.system.||
for parallel for
loop support.GC_setMaxPause
and GC_step
procs.recvLine
is now much more efficient thanks to the newly implemented sockets buffering.times.format
as well as many other utility functions
for managing time.system.@
for converting an openarray
to a seq
(it used to
only support fixed length arrays).system.compiles
which can be used to check whether a type supports
some operation.strutils.format
, subexes.format
which use the
new varargs
type.fsmonitor
.system
, os
, osproc
and memfiles
modules use the wide
string versions of the WinAPI. Use the -d:useWinAnsi
switch to revert
back to the old behaviour which uses the Ansi string versions.static
, do
, interface
and mixin
are now keywords.immediate
pragma for templates
to get a template of old behaviour.expr
and
PNimrodNode
which unfortunately breaks the old macro system.pegs.@
has been renamed to pegs.!*
and pegs.@@
has been renamed
to pegs.!*\
as @
operators now have different precedence.proc
(without any params or return type) is now considered a
type class matching all proc types. Use proc ()
to get the old meaning
denoting a proc expecing no arguments and returning no value.system.GC_setStrategy
.re.findAll
and pegs.findAll
don’t return captures anymore but
matching substrings.marshall
module don’t contain the proper field names
of tuples anymore. This had to be changed as the old behaviour never
produced consistent results.ssl
module.nimrod pretty
as it never worked good enough and has some
inherent problems.int
to int32
are now forbidden.system.byte
is now an alias for uint8
; it used to be an alias
to int8
.bind
expressions in templates are not properly supported anymore. Use
the declarative bind
statement instead.closure
,
for procs it remains nimcall
(which is compatible to closure
).
Activate the warning ImplicitClosure
to make the compiler list the
occurrences of proc types which are affected.openarray
from varargs
.hygienic
. Use the dirty
pragma to get the old
behaviour.final
. Use
the inheritable
pragma to introduce new object roots apart
from TObject
.callsite
builtin
to gain access to the invocation AST.os.getAppFilename
and os.getAppDir
cannot work reliably on BSD.--implicitStatic
command line
option or pragma.doc2
command. This new generator uses all of the semantic passes
of the compiler and can thus generate documentation for symbols hiding in
macros.dynlib
pragma for variables.bycopy
and byref
pragmas that affect how
objects/tuples are passed.static
sections for enforced compile time evaluation.do
.addr
is now treated like a prefix operator syntactically.global
pragma that can be used to introduce new global variables
from within procs.when
expressions are now allowed just like if
expressions.@
is different now
allowing for sigil-like operators.finally
and except
blocks are now supported.range
over some built-in operators.proc divmod(a, b: int; resA, resB: var int)
.inc i; inc j
.bind
supports overloaded symbols and operators.distinct
type can now borrow from generic procs.gensym
, inject
and dirty
for hygiene
in templates.pure
so that their field names do not pollute
the current scope.result = expression
then.Version 0.8.14 has been released!
EIO
exception was raised for
the end of file for text files that do not end with a newline.--out
option has never worked properly.os.AppendFileExt
, os.executeShellCommand
,
os.iterOverEnvironment
, os.pcDirectory
, os.pcLinkToDirectory
,
os.SplitPath
, os.extractDir
, os.SplitFilename
,
os.extractFileTrunk
, os.extractFileExt
, osproc.executeProcess
,
osproc.executeCommand
.parseopt.init
, parseopt.getRestOfCommandLine
.strutils.validEmailAddress
to matchers.validEmailAddress
.^
has been removed, so that ^
can now be a user-defined operator.implies
is no keyword anymore.is
operator is now the of
operator.is
operator is now used to check type equivalence in generic code.pure
pragma for procs has been renamed to noStackFrame
.unidecode
module is now thread-safe and its interface has changed.bind
expression is deprecated, use a bind
declaration instead.system.raiseHook
is now split into system.localRaiseHook
and
system.globalRaiseHook
to distinguish between thread local and global
raise hooks.os.removeFile
and
os.removeDir
.*=
) are now special-cased.TStream
have been renamed to have an Impl
suffix
because they should not be used directly anymore.
Wrapper procs have been created that should be used instead.export
is now a keyword.assert
is now implemented in pure Nimrod as a template; it’s easy
to implement your own assertion templates with system.astToStr
.is
and of
operators.void
can be used to denote the absence of any type.
This is useful in generic code.var T
to return an l-value.discardable
pragma that can be used to mark a routine
so that its result can be discarded implicitly.noinit
pragma to prevent automatic initialization to zero
of variables.seq
.a{i, ...}
that has no semantics yet for built-in types and so can be overloaded to your
heart’s content.bind
(used for symbol binding in templates and generics) is now a
declarative statement.let
statement.items
and pairs
are implicitly invoked when
an explicit iterator is missing.a[i..j] = b
where a
is a sequence or string
now supports splicing.importcpp
and importobjc
make interfacing with C++
and Objective C somewhat easier.incompleteStruct
to deal with incomplete C struct
definitions.--nimcache:PATH
configuration option for control over the output
directory for generated code.--genScript
option now produces different compilation scripts
which do not contain absolute paths.--cincludes:dir
, --clibdir:lib
configuration options for
modifying the C compiler’s header/library search path in cross-platform way.--clib:lib
configuration option for specifying additional
C libraries to be linked.--mainmodule:file
configuration options for specifying the main
project file. This is intended to be used in project configuration files to
allow commands like nimrod c
or nimrod check
to be executed anywhere
within the project’s directory structure.--app:staticlib
option for creating static libraries.--tlsEmulation:on|off
switch for control over thread local
storage emulation.TaintedString
string type. If the taint
mode is turned on it is a distinct string type which helps to detect input
validation errors.--symbolFiles:on
.
This potentially speeds up compilations by an order of magnitude, but is
still highly experimental!--import:file
and --include:file
configuration options
for specifying modules that will be automatically imported/incluced.nimrod i
can now optionally be given a module to execute.bool
for on|off
switches in pragmas. In order to not break existing code,
on
and off
are now aliases for true
and false
and declared
in the system module.system.allocShared
, system.allocShared0
,
system.deallocShared
, system.reallocShared
.matchers
module for email address etc. matching.strutils.unindent
, strutils.countLines
,
strutils.replaceWord
.system.slurp
for easy resource embedding.system.running
for threads.system.programResult
.xmltree.innerText
.os.isAbsolute
, os.dynLibFormat
, os.isRootDir
,
os.parentDirs
.parseutils.interpolatedFragments
.macros.treeRepr
, macros.lispRepr
, macros.dumpTree
,
macros.dumpLisp
, macros.parseExpr
, macros.parseStmt
,
macros.getAst
.locks
core module for more flexible locking support.irc
module.ftpclient
module.memfiles
module.subexes
module.critbits
module.asyncio
module.actors
module.algorithm
module for generic sort
, reverse
etc. operations.osproc.startCmd
, osproc.execCmdEx
.osproc
module now uses posix_spawn
instead of fork
and exec
on Posix systems. Define the symbol useFork
to revert to
the old implementation.intsets.assign
.system.astToStr
and system.rand
, system.doAssert
.system.pairs
for built-in types like arrays and strings.httpclient
correct passes the path starting with /
.htmlparser
module.pegs.find
did not respect start
parameter.dialogs.ChooseFilesToOpen
did not work if only one file is
selected.nimrod
is not default dir for every project.try except
matching.^
are now right-associative and have the highest
priority.os.getApplicationFilename
: Use os.getAppFilename
instead.os.getApplicationDir
: Use os.getAppDir
instead.system.copy
: Use substr
or string slicing instead.module.re"abc"
is now supported.strutils.%
, ropes.%
if both notations $#
and $i
are involved.pegs
and re
modules distinguish between replace
and replacef
operations.p^
is deprecated and might become
^p
in later versions or be dropped entirely since it is rarely used.
Use the new notation p[]
in the rare cases where you need to
dereference a pointer explicitly.system.readFile
does not return nil
anymore but raises an EIO
exception instead.linearScanEnd
, unroll
, shallow
pragmas.emit
pragma for direct code generator control.for
loops anymore.enum
may be given an explicit string representation.
This yields more maintainable code than using a constant
array[TMyEnum, string]
mapping.[enumValueA: "a", enumValueB: "b"]
.threads
core module and
the --threads:on
command line switch.system.fields
and system.fieldPairs
can be
used to iterate over any field of a tuple. With this mechanism operations
like ==
and hash
are lifted to tuples...
is now a first-class operator, allowing code like:
x in 1000..100_000
.idetools
command line
options.lists
module which contains generic linked lists.sets
module which contains generic hash sets.tables
module which contains generic hash tables.queues
module which contains generic sequence based queues.intsets
module which contains a specialized int set data type.scgi
module.smtp
module.encodings
module.re.findAll
, pegs.findAll
.os.findExe
.parseutils.parseUntil
and parseutils.parseWhile
.strutils.align
, strutils.tokenize
, strutils.wordWrap
.{@}
.\letter
, \upper
, \lower
,
\title
, \white
.\skip
operation.$
and ^
anchors.complex
module.strutils.formatFloat
, strutils.formatBiggestFloat
.<
for nice looking excluding upper bounds in ranges.math.floor
.system.reset
and a version of system.open
that
returns a TFile
and raises an exception in case of an error.redis
.0mq
via the zmq
module.sphinx
.system.newStringOfCap
.system.raiseHook
and system.outOfMemHook
.system.writeFile
.system.shallowCopy
.system.echo
is guaranteed to be thread-safe.prelude
include file for scripting convenience.typeinfo
core module for access to runtime type information.marshal
module for JSON serialization.os.parseCmdLine
now adheres
to the same parsing rules as Microsoft’s C/C++ startup code.ref
pointer to the untyped pointer
type is invalid.keyval
example.system.splitChunk
still contained code for debug output.dialogs.ChooseFileToSave
uses STOCK_SAVE
instead of
STOCK_OPEN
for the GTK backend.low(somestring)
crashed the compiler.strutils.endsWith
lacked range checking.os.copyFile
and os.moveFile
!!!procvar
cannot only be passed to a procvar anymore,
unless they are used in the same module.times.getStartMilsecs
: Use epochTime
or cpuTime
instead.system.OpenFile
.system.CloseFile
.strutils.replaceStr
.strutils.deleteStr
.strutils.splitLinesSeq
.strutils.splitSeq
.strutils.toString
.dynlib
pragma) EInvalidLibrary
is not raised anymore. Instead system.quit()
is called. This is because
raising an exception requires heap allocations. However the memory manager
might be contained in the DLL that failed to load.re
module (and the pcre
wrapper) now depend on the pcre dll.{.compile: "file.c".}
pragma uses a CRC check to see if the file
needs to be recompiled.system.reopen
.system.getCurrentException
.system.appType
.system.compileOption
.times.epochTime
and times.cpuTime
.{.size: sizeof(cint).}
pragma for enum types. This is useful
for interfacing with C.{.pragma.}
pragma for user defined pragmas.{.extern.}
pragma for better control of name mangling.importc
and exportc
pragmas support format strings:
proc p{.exportc: "nim_$1".}
exports p
as nim_p
. This is useful
for user defined pragmas.expat
module.json
module.-d:tinyc
to enable Tiny C support. Nimrod
can then execute code directly via nimrod run myfile
.os.copyFile
has better error handling.parsexml
module concerning the parsing of
<tag attr="value" />
.parsexml
module concerning the parsing of
enities like <XX
.system.write(f: TFile, s: string)
now works even if s
contains binary
zeros.os.setFilePermissions
for Windows.strutils.cmpIgnoreCase
.unicode.toUTF8
.'\n'
(use "\n"
instead).times.getStartMilsecs()
now works on Mac OS X.pegs.match
concerning start offsets.system.cstringArrayToSeq
.system.lines(f: TFile)
iterator.system.delete
, system.del
and system.insert
for sequences.system./
for int.system.newException
template.cgi.decodeData(data: string): tuple[key, value: string]
.strutils.insertSep
.math.trunc
.ropes
module.sockets
module.browsers
module.httpserver
module.httpclient
module.parseutils
module.unidecode
module.xmldom
module.xmldomparser
module.xmltree
module.xmlparser
module.htmlparser
module.re
module.graphics
module.colors
module.GTK_
,
lua
). The old wrappers are still available in lib/oldwrappers
.
You can change your configuration file to use these."
in more contexts.""
within raw string literals stands for a single quotation mark.openArray
parameters can be left out... raw:: html
directive.$capture_index
.path
option
has been reversed, so that the project’s path is searched before
the standard library’s path.pas2nim
tool that contains the old functionality.os.copyFile
and os.moveFile
have been deprecated
temporarily, so that the compiler warns about their usage. Use them with
named arguments only, because the parameter order will change the next
version!atomic
and let
are now keywords.\w
character class for pegs now includes the digits '0'..'9'
.GTK_
,
lua
) anymore.openArray
parameters can be left out.The version jump from 0.8.2 to 0.8.6 acknowledges the fact that all development of the compiler is now done in Nimrod.
hint[X]:off
and warning[X]:off
now work.for x in lines.split()
).removeDir
for POSIX that lead to an infinite recursion.dynlib
pragma are now possible.os.parseCmdLine
returned wrong results for trailing whitespace.system.contains
for open arrays.@
.SAD|IND
is allowed before any kind of closing bracket.
This allows for more flexible source code formatting.bind
context. (See manual.html#templates for details.)discard """my long comment"""
is now optimized away.--floatChecks: on|off
switches and pragmas for better debugging
of floating point operations. (See
manual.html#types-pre-defined-floating-point-types for details.)os.splitFile(".xyz")
now returns ("", ".xyz", "")
instead of
("", "", ".xyz")
. So filenames starting with a dot are handled
differently.strutils.split(s: string, seps: set[char])
never yields the empty string
anymore. This behaviour is probably more appropriate for whitespace splitting.--version
command line switch.msg
field of system.E_base
has now the type string
, instead
of cstring
. This improves memory safety.