Here are some ideas/tips I use to navigate unknown code.

  * As others have said, if possible use an IDE/editor that can go to 
definitions.



Regardless of having an IDE or editor:

  * Even if you know the module from using `from module import nil`, you don't 
necessarily know _which_ proc is the right one if the same proc name occurs 
with different overloading.
  * Often the functionality of a call is (mostly) clear from the calling 
function and the proc name and the names and types of arguments for the called 
function.
  * Read or at least skim the documentation of imported modules. This also 
helps with getting the big picture of the package you're dealing with.



Specifically for the standard library:

  * Familiarize yourself with the standard library. Read the overview page 
[https://nim-lang.org/docs/lib.html](https://nim-lang.org/docs/lib.html) and if 
possible do a quick scan over each of the module-specific pages to get an 
impression of the functionality of the modules and thus the standard library.
  * Use the search box on the left at 
[https://nim-lang.org/docs/lib.html](https://nim-lang.org/docs/lib.html) . 
Depending on the context in your code, often only one or two definitions look 
and are relevant.



In your own code:

  * Try to use good names for procs, templates, macros and their arguments.
  * Use keyword arguments if it helps clarity.
  * Write interface comments to help readers of the code and to make generated 
documentation more useful.



This last category of tips helps _others_ to read and understand _your_ code, 
even without looking up the definitions of procs/templates/macros you're 
calling.

Reply via email to