Chapter 1. Why Nim?
Figure 1.1. Compilation backends
Figure 1.2. How Nim compiles source code
Figure 1.3. How the Nim compilation process compares to other programming languages
Chapter 2. Getting started
Chapter 3. Writing a chat application
Figure 3.1. My screen after I send the message
Figure 3.2. John’s and Grace’s screens
Figure 3.3. Client-server vs. peer-to-peer
Figure 3.4. The operation of the chat application
Figure 3.5. Successful compilation of client.nim
Figure 3.6. Starting the client without any parameters
Figure 3.7. Starting the client with one parameter
Figure 3.8. The supplied command-line parameters and how to access them
Figure 3.9. Problem caused by the client being blocked indefinitely
Figure 3.10. Blocking execution of client.nim
Figure 3.11. Blocking execution of client.nim with spawn
Figure 3.12. Good and bad protocols
Figure 3.13. The steps needed to start accepting new connections on a server socket
Figure 3.14. The difference between synchronous and asynchronous accept
Figure 3.15. Nim’s asyncdispatch event loop
Figure 3.16. The execution of listing 3.17
Figure 3.17. The nonblocking parallel execution of client.nim)
Chapter 4. A tour through the standard library
Figure 4.1. The most useful pure modules
Figure 4.2. The most useful impure modules
Figure 4.3. The compiler searches for modules starting in the project’s directory.
Figure 4.4. The example.nim file has been moved into the misc directory.
Figure 4.5. The documentation for the os module
Figure 4.6. Looking up the value of the key "Dog" in the animalsAges hash table
Chapter 5. Package management
Figure 5.1. Comparison between packages, libraries, applications, and software repositories
Figure 5.2. System-level vs. application-level package managers
Figure 5.3. Some commands that Nimble supports
Figure 5.4. Searching for a “linux” package with version information
Figure 5.5. A typical Nimble package
Figure 5.6. An external Nimble package’s evolution
Figure 5.7. The output of nimble install daemonize
Figure 5.8. The Nimble installation process
Figure 5.9. Finding information about the daemonize package in the packages.json file
Figure 5.10. How Nimble decides which version of a package to install
Figure 5.11. The NimbleExample directory layout
Figure 5.12. The nimble init command
Figure 5.13. nim c vs. nimble c
Figure 5.14. Creating a new repository on GitHub
Figure 5.15. Local Nimble package with no repository vs. one with a Git repository
Chapter 6. Parallelism
Figure 6.1. Concurrent execution of two processes
Figure 6.2. Parallel execution of two processes
Figure 6.3. The two possible executions of listing 6.4
Figure 6.5. Synchronized and unsynchronized execution of listing 6.21
Chapter 7. Building a Twitter clone
Figure 7.1. The three different components in the MVC architecture and how they interact
Figure 7.2. The three different MVC components as seen on a calculator’s GUI
Figure 7.3. An HTTP request to twitter.com
Figure 7.4. HTTP requests and routing in Jester
Figure 7.5. The components of Tweeter and how they’ll be developed
Figure 7.6. Successful initialization of a Nimble package
Figure 7.7. The successful compilation and execution of tweeter
Figure 7.8. “Hello World!” from Jester
Figure 7.9. A sample Twitter message
Figure 7.10. The database tables
Figure 7.11. Storing follow data in the database
Figure 7.12. The process of displaying information about a user in the web browser
Figure 7.13. The view created by listing 7.18
Figure 7.14. The Follow button constructed by renderUser in listing 7.20
Figure 7.15. A message produced by renderMessages
Figure 7.16. The rendered login page
Figure 7.17. The unstyled login form
Figure 7.19. Debug information from Jester
Figure 7.20. The current login process
Figure 7.21. A simple timeline
Figure 7.22. A timeline with messages
Chapter 8. Interfacing with other languages
Figure 8.2. Static vs. dynamic linking
Figure 8.3. printf wrapped in Nim
Figure 8.4. The mapping between fields in a wrapped type and a C struct
Figure 8.5. The application you’ll produce in this section
Figure 8.6. The result of running listing 8.8
Figure 8.7. The final sdl_test application with the letter N drawn
Figure 8.8. How the same code is shared between two platforms
Figure 8.9. The differences in JavaScript code produced with the importc and importcpp pragmas
Figure 8.10. The canvas_test.nim script showing a blue screen in the web browser
Figure 8.11. The canvas_test.nim script showing a blue screen with the letter N in the web browser
Chapter 9. Metaprogramming
Figure 9.1. Templates are expanded during the compilation of Nim source code
Figure 9.2. A code block passed into the repeat template is substituted into its body
Figure 9.4. Templates are declarative, whereas macros are procedural.
Figure 9.5. A simple AST for 5 * (5 + 10)
Figure 9.6. An annotated version of figure 9.5 showing how it maps onto root in listing 9.1
Appendix B. Installing Nim
Figure B.1. The nim directory after it’s been extracted from the archive
Figure B.2. Terminal after navigating to /home/dom/programs/nim
3.15.189.199