DEV Community

ringabout
ringabout

Posted on

Best ways to make your first contribution to Nim language for Hacktoberfest 2021

Concise and readable, small binaries, fast compile times, native performance, zero-overhead interop lets you reuse code in C, C++, JS, Objective-C, Python... Does a programming language have these fantastic features? Of course, Nim language does have the features I have been dreaming about. And what is the goal of Nim language? Simply put, the goal is "one language to rule them all", from shell scripting to web frontend and backend,
scientific computing, deep learning,
blockchain client, gamedev,
embedded.

Moreover, Nim is a community driven collaborative effort that welcomes all contributions, big or small. Read contributing guide if you are willing to contribute to Nim. In this article, I will tell you best ways to make your first contribution to Nim language. Starting from easy and feasible pull requests, you will surely enjoy the charm of open source projects. Let's start our journey.

Replace code-block with runnableExamples

Some modules are using code-blocks which are outdated and should be replaced by runnableExamples. Search .. code-block in your favourite editor and change the ones in standard libraries.

For instance

before

## .. code-block:: Nim
##   import std/json
##
##   let jsonNode = parseJson("""{"key": 3.14}""")
##
##   doAssert jsonNode.kind == JObject
##   doAssert jsonNode["key"].kind == JFloat
Enter fullscreen mode Exit fullscreen mode

after

runnableExamples:
  let jsonNode = parseJson("""{"key": 3.14}""")
  doAssert jsonNode.kind == JObject
  doAssert jsonNode["key"].kind == JFloat
Enter fullscreen mode Exit fullscreen mode

Note that the import of the current module can be left out. If the original snippet cannot be run, use runnableExamples("-r:off") instead.

Add testcase to close issues

When surfing issues of Nim, you can find some code which have already worked. Submit a pull request to close that issue. You can refer to https://github.com/nim-lang/Nim/pull/18934 and track issues labelled as works_but_needs_test_case or works_with_arc_orc.

Add top-level runnableExamples for modules

Some modules lack top-level runnableExamples, please help them. Such as:

Add runnableExamples or documentations for procs

Some procs lack corresponding runnableExamples and documentations. Please find them and complete them.

Solve issues labelled as easy

If you like some challenges, start from issues labelled as easy.

Top comments (0)