Ill try to show that Nim 1.0 programming language standard library should not 
be 1:1 with the bunch of modules that currently ships with the Nim reference 
implementation.

**Preliminaries**

A programming language is not only a syntax, but also a runtime. At minimum, a 
runtime should offer functions for input and output. The more batteries in the 
runtime, the better for the end user. When designing a runtime, especially 
these non-functional requirements should be considered: performance, 
implementability, maintainability, applicability, usability and portability. 
The portability of runtime library can be ensured by standardizing it, 
whereupon it is called the language’s standard library. A standardized library 
ensures that source code will work across implementations and later versions. 
For example, standard library 1.0 source code written for compiler A 
implemented by company B for operating system C targeting machine D will work 
without refactoring with standard library 1.6 for compiler X implemented by 
community Y for virtual machine Z.

**Definitions**

  * stdlib: The forthcoming Nim 1.0 programming language standard library
  * cnimc:The Nim compiler reference implementation targeting C
  * jsnimc: The Nim compiler reference implementation targeting Javascript
  * nimcc: The application containing cnimc and jsnimc that can be installed 
from [here](https://nim-lang.org/install.html)
  * nimcc library: The collection of modules that ships with nimcc, as listed 
[here](https://nim-lang.org/docs/lib.html)



**Theorem**

stdlib should be a non-empty proper subset of nimcc library

**Proof, in 3 parts**

Part 1: stdlib should be non-empty (Proof by contradiction)

If stdlib is empty, it would essentially mean that stdlib would equal 
system.nim. To prove that stdlib should be non-empty, it is enough to show one 
module that should be included in stdlib. We use macros module for this. It is 
stated at Nim official website, Wikipedia, and Nim in Action book that 
metaprogramming (hygienic term rewriting macros) is one of Nim’s core features. 
A standard library without macros module would therefore define a language that 
is not Nim.

Part 2: stdlib should be proper subset of nimcc library (Proof by reductio ad 
absurdum)

To prove this, it is enough to show one module that is in nimcc library but 
should not be in stdlib. We use winlean module for this. If nimlean is part of 
stdlib, it means that jsnimc must implement every function in it to be 
compliant. However, it is practically impossible to implement windows inside 
browser sandbox where javascript runtime tends to run.

Part 3: stdlib should not be a superset of nimcc library (Proof by contraction)

The label 1.0 signals that the language is production-ready. If stdlib would 
contain a module that is not shipped with nimcc, it would mean that no 
reference implementation for Nim exists, and therefore the language 
specification could not claim 1.0 status.

By elementary logic, the conjunction of parts 1-3 proves the theorem. QED.

**Corollary**

If Nim standards committee indeed decides that stdlib will not be 1:1 to nimcc 
library, the set of modules shipped with nimcc must be renamed to something 
else.

Reply via email to