Skip to content

Commit

Permalink
docs: fix some spelling errors (nim-lang#19816)
Browse files Browse the repository at this point in the history
* docs: fix some spelling errors

* contributing: fix spelling error

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

* Update contributing.md

* Update intern.md

* Update manual.md

* Update manual_experimental_strictnotnil.md

* Update nimgrep_cmdline.txt

* Update pegdocs.txt

* Update testament.md

* Update tut1.md

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 9, 2022
1 parent e8ae2dc commit b4157f6
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 141 deletions.
70 changes: 36 additions & 34 deletions doc/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Contributing
.. contents::


Contributing happens via "Pull requests" (PR) on github. Every PR needs to be
Contributing happens via "Pull requests" (PR) on GitHub. Every PR needs to be
reviewed before it can be merged and the Continuous Integration should be green.
The title of a PR should contain a brief description. If it fixes an issue,
in addition to the number of the issue, the title should also contain a description
Expand Down Expand Up @@ -158,7 +158,7 @@ To run a single test:
```

For reproducible tests (to reproduce an environment more similar to the one
run by Continuous Integration on github actions/azure pipelines), you may want to disable your
run by Continuous Integration on GitHub actions/azure pipelines), you may want to disable your
local configuration (e.g. in ``~/.config/nim/nim.cfg``) which may affect some
tests; this can also be achieved by using
`export XDG_CONFIG_HOME=pathtoAlternateConfig`:cmd: before running `./koch`:cmd:
Expand Down Expand Up @@ -198,8 +198,8 @@ tell you if any new tests passed/failed.
Deprecation
===========

Backward compatibility is important, so instead of a rename you need to deprecate
the old name and introduce a new name:
Backwards compatibility is important. When renaming types, procedures, etc. the old name
must be marked as deprecated using the `deprecated` pragma:

```nim
# for routines (proc/template/macro/iterator) and types:
Expand Down Expand Up @@ -310,7 +310,7 @@ Inline monospaced text can be input using \`single backticks\` or
the latter are not.
To avoid accidental highlighting follow this rule in ``*.nim`` files:

* use single backticks for fragments of code in Nim and other
* Use single backticks for fragments of code in Nim and other
programming languages, including identifiers, in ``*.nim`` files.

For languages other than Nim add a role after final backtick,
Expand All @@ -326,12 +326,12 @@ To avoid accidental highlighting follow this rule in ``*.nim`` files:
Highlight shell commands by ``:cmd:`` role; for command line options use
``:option:`` role, e.g.: \`--docInternal\`:option:.

* prefer double backticks otherwise:
* Use double backticks:

* for file names: \`\`os.nim\`\`
* for fragments of strings **not** enclosed by `"` and `"` and not
* For file names: \`\`os.nim\`\`
* For fragments of strings **not** enclosed by `"` and `"` and not
related to code, e.g. text of compiler messages
* also when code ends with a standalone ``\`` (otherwise a combination of
* When code ends with a standalone ``\`` (otherwise a combination of
``\`` and a final \` would get escaped)

.. Note:: ``*.rst`` files have ``:literal:`` as their default role.
Expand Down Expand Up @@ -396,7 +396,7 @@ rationale: https://forum.nim-lang.org/t/4089

.. _tests_use_doAssert:
Use `doAssert` (or `unittest.check`, `unittest.require`), not `assert` in all
tests so they'll be enabled even with `--assertions:off`:option:.
tests, so they'll be enabled even with `--assertions:off`:option:.

```nim
block: # foo
Expand All @@ -423,7 +423,7 @@ second example below:
.. _delegate_printing:
Delegate printing to caller: return `string` instead of calling `echo`
rationale: it's more flexible (e.g. allows the caller to call custom printing,
including prepending location info, writing to log files, etc).
including prepending location info, writing to log files, etc.).

```nim
proc foo() = echo "bar" # bad
Expand Down Expand Up @@ -476,7 +476,7 @@ General commit rules
your editor reformatted automatically the code or whatever different reason,
this should be excluded from the commit.

*Tip:* Never commit everything as is using `git commit -a`:cmd:, but review
*Tip:* Never commit everything as-is using `git commit -a`:cmd:, but review
carefully your changes with `git add -p`:cmd:.

4. Changes should not introduce any trailing whitespace.
Expand All @@ -494,16 +494,16 @@ General commit rules
Fixes #123; refs #124

indicates that issue ``#123`` is completely fixed (GitHub may automatically
close it when the PR is committed), wheres issue ``#124`` is referenced
close it when the PR is committed), whereas issue ``#124`` is referenced
(e.g.: partially fixed) and won't close the issue when committed.

6. PR body (not just PR title) should contain references to fixed/referenced github
issues, e.g.: ``fix #123`` or ``refs #123``. This is so that you get proper cross
referencing from linked issue to the PR (github won't make those links with just
PR title, and commit messages aren't always sufficient to ensure that, e.g.
can't be changed after a PR is merged).
6. PR body (not just PR title) should contain references to fixed/referenced GitHub
issues, e.g.: ``fix #123`` or ``refs #123``. This is so that you get proper
cross-referencing from linked issue to the PR (GitHub won't make those links
with just a PR title, and commit messages aren't always sufficient to ensure
that, e.g. can't be changed after a PR is merged).

7. Commits should be always be rebased against devel (so a fast forward
7. Commits should be always be rebased against devel (so a fast-forward
merge can happen)

e.g.: use `git pull --rebase origin devel`:cmd:. This is to avoid messing up
Expand All @@ -523,14 +523,14 @@ Continuous Integration (CI)
1. Continuous Integration is by default run on every push in a PR; this clogs
the CI pipeline and affects other PR's; if you don't need it (e.g. for WIP or
documentation only changes), add ``[skip ci]`` to your commit message title.
This convention is supported by our github actions pipelines and our azure pipeline
This convention is supported by our GitHub actions pipelines and our azure pipeline
(using custom logic, which should complete in < 1mn) as well as our former other pipelines:
`Appveyor <https://www.appveyor.com/docs/how-to/filtering-commits/#skip-directive-in-commit-message>`_
and `Travis <https://docs.travis-ci.com/user/customizing-the-build/#skipping-a-build>`_.

2. Consider enabling CI (azure, GitHub actions and builds.sr.ht) in your own Nim fork, and
waiting for CI to be green in that fork (fixing bugs as needed) before
opening your PR in the original Nim repo, so as to reduce CI congestion. Same
opening your PR in the original Nim repo, to reduce CI congestion. Same
applies for updates on a PR: you can test commits on a separate private
branch before updating the main PR.

Expand All @@ -547,11 +547,12 @@ Debugging CI failures, flaky tests, etc
follow these instructions to only restart the jobs that failed:

* Azure: if on your own fork, it's possible from inside azure console
(e.g. ``dev.azure.com/username/username/_build/results?buildId=1430&view=results``) via ``rerun failed jobs`` on top.
(e.g. ``dev.azure.com/username/username/_build/results?buildId=1430&view=results``) via
``rerun failed jobs`` on top.
If either on you own fork or in Nim repo, it's possible from inside GitHub UI
under checks tab, see https://github.com/timotheecour/Nim/issues/211#issuecomment-629751569
* GitHub actions: under "Checks" tab, click "Re-run jobs" in the right.
* builds.sr.ht: create a sourcehut account so you can restart a PR job as illustrated.
* builds.sr.ht: create a SourceHut account so that you can restart a PR job as illustrated.
builds.sr.ht also allows you to ssh to a CI machine which can help a lot for debugging
issues, see docs in https://man.sr.ht/builds.sr.ht/build-ssh.md and
https://drewdevault.com/2019/08/19/Introducing-shell-access-for-builds.html; see
Expand All @@ -566,7 +567,7 @@ Code reviews
https://forum.nim-lang.org/t/4317

2. When reviewing large diffs that may involve code moving around, GitHub's interface
doesn't help much as it doesn't highlight moves. Instead, you can use something
doesn't help much, as it doesn't highlight moves. Instead, you can use something
like this, see visual results `here <https://github.com/nim-lang/Nim/pull/10431#issuecomment-456968196>`_:

```cmd
Expand Down Expand Up @@ -619,7 +620,7 @@ Time handling, especially the `Time` type are also covered by this rule.
Existing, battle-tested modules stay
------------------------------------

Reason: There is no benefit in moving them around just to fullfill some design
Reason: There is no benefit in moving them around just to fulfill some design
fashion as in "Nim's core MUST BE SMALL". If you don't like an existing module,
don't import it. If a compilation target (e.g. JS) cannot support a module,
document this limitation.
Expand All @@ -633,7 +634,7 @@ Syntactic helpers can start as experimental stdlib modules

Reason: Generally speaking as external dependencies they are not exposed
to enough users so that we can see if the shortcuts provide enough benefit
or not. Many programmers avoid external dependencies, even moreso for
or not. Many programmers avoid external dependencies, especially for
"tiny syntactic improvements". However, this is only true for really good
syntactic improvements that have the potential to clean up other parts of
the Nim library substantially. If in doubt, new stdlib modules should start
Expand All @@ -658,7 +659,7 @@ to existing modules is acceptable. For two reasons:
("Why does sequtils lack a `countIt`?
Because version 1.0 happens to have lacked it? Silly...")
2. To encourage contributions. Contributors often start with PRs that
add simple things and then they stay and also fix bugs. Nim is an
add simple things, then they stay and also fix bugs. Nim is an
open source project and lives from people's contributions and involvement.
Newly introduced issues have to be balanced against motivating new people. We know where
to find perfectly designed pieces of software that have no bugs -- these are the systems
Expand All @@ -684,7 +685,7 @@ Conventions
Breaking Changes
================

Introducing breaking changes, no matter how well intentioned,
Introducing breaking changes, no matter how well-intentioned,
creates long-term problems for the community, in particular those looking to promote
reusable Nim code in libraries: In the Nim distribution, critical security and bugfixes,
language changes and community improvements are bundled in a single distribution - it is
Expand Down Expand Up @@ -719,14 +720,14 @@ Examples of run-time breaking changes:
* "Nim's path handling procs like `getXDir` now consistently lack the trailing slash"
* "Nim's strformat implementation is now more consistent with Python"

Instead write new code that explicitly announces the feature you think we announced but
Instead, write new code that explicitly announces the feature you think we announced but
didn't. For example, `strformat` does not say "it's compatible with Python", it
says "inspired by Python's f-strings". This new code can be submitted to the stdlib
and the old code can be deprecated or it can be published as a Nimble package.
and the old code can be deprecated or published as a Nimble package.

Sometimes, a run-time breaking change is most desirable: For example, a string
representation of a floating point number that "roundtrips" is much better than
a string represenation that doesn't. These run-time breaking changes must start in the
a string representation that doesn't. These run-time breaking changes must start in the
state "opt-in" via a new `-d:nimPreviewX` or command line flag and then should become
the new default later, in follow-up versions. This way users can track
regressions more easily. ("git bisect" is not an acceptable alternative, that's for
Expand All @@ -740,18 +741,19 @@ Compile-time breaking changes
-----------------------------

Compile-time breaking changes are usually easier to handle, but for large code bases
it can also be much work and it can hinder the adoption of a new Nim release.
they can also involve a large amount of work and can hinder the adoption of a new
Nim release.
Additive approaches are to be preferred here as well.

Examples of compile-time breaking changes include (but are not limited to):

* Renaming functions and modules, or moving things. Instead of a direct rename,
deprecate the old name and introduce a new one.
* Renaming the parameter names: Thanks to Nim's "named parameter" calling syntax
like `f(x = 0, y = 1)` this is a breaking change. Instead live with the existing
like `f(x = 0, y = 1)` this is a breaking change. Instead, live with the existing
parameter names.
* Adding an enum value to an existing enum. Nim's exhaustive case statements stop
compiling after such a change. Instead consider to introduce new `bool`
compiling after such a change. Instead, consider to introduce new `bool`
fields/parameters. This can be impractical though, so we use good judgement
and our list of "important packages" to see if it doesn't break too much code
out there in practice.
Expand Down
2 changes: 1 addition & 1 deletion doc/effects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Iff a proc is side effect free and all its argument are evaluable at
compile time, it can be evaluated by the compiler. However, really
difficult is the ``newString`` proc: If it is simply wrapped, it
should not be evaluated at compile time! On other occasions it can
and should be evaluted:
and should be evaluated:

.. code-block:: nim
proc toUpper(s: string): string =
Expand Down
30 changes: 15 additions & 15 deletions doc/intern.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Bisecting for regressions
-------------------------

There are often times when there is a bug that is caused by a regression in the
compiler or stdlib. Bisecting the Nim repo commits is a usefull tool to identify
compiler or stdlib. Bisecting the Nim repo commits is a useful tool to identify
what commit introduced the regression.

Even if it's not known whether a bug is caused by a regression, bisection can reduce
Expand Down Expand Up @@ -117,15 +117,15 @@ fastest to build a compiler that is instrumented for debugging from an
existing release build. `koch temp`:cmd: provides a convenient method of doing
just that.

By default running `koch temp`:cmd: will build a lean version of the compiler
By default, running `koch temp`:cmd: will build a lean version of the compiler
with `-d:debug`:option: enabled. The compiler is written to `bin/nim_temp` by
default. A lean version of the compiler lacks JS and documentation generation.

`bin/nim_temp` can be directly used to run testcases, or used with testament
with `testament --nim:bin/nim_temp r tests/category/tsometest`:cmd:.

`koch temp`:cmd: will build the temporary compiler with the `-d:debug`:option:
enabled. Here are compiler options that are of interest for debugging:
enabled. Here are compiler options that are of interest when debugging:

* `-d:debug`:option:\: enables `assert` statements and stacktraces and all
runtime checks
Expand Down Expand Up @@ -156,11 +156,11 @@ Debug logging

"Printf debugging" is still the most appropriate way to debug many problems
arising in compiler development. The typical usage of breakpoints to debug
the code is often less practical, because almost all of the code paths in the
the code is often less practical, because almost all code paths in the
compiler will be executed hundreds of times before a particular section of the
tested program is reached where the newly developed code must be activated.

To work-around this problem, you'll typically introduce an if statement in the
To work around this problem, you'll typically introduce an if statement in the
compiler code detecting more precisely the conditions where the tested feature
is being used. One very common way to achieve this is to use the `mdbg` condition,
which will be true only in contexts, processing expressions and statements from
Expand Down Expand Up @@ -374,7 +374,7 @@ Files that may need changed for your platform include:
Add os/cpu compiler/linker flags.

If the `--os` or `--cpu` options aren't passed to the compiler, then Nim will
determine the current host os, cpu and endianess from `system.cpuEndian`,
determine the current host os, cpu and endianness from `system.cpuEndian`,
`system.hostOS` and `system.hostCPU`. Those values are derived from
`compiler/platform.nim`.

Expand All @@ -398,17 +398,17 @@ Runtime type information
programming language:

Garbage collection
The old GCs use the RTTI for traversing abitrary Nim types, but usually
The old GCs use the RTTI for traversing arbitrary Nim types, but usually
only the `marker` field which contains a proc that does the traversal.

Complex assignments
Sequences and strings are implemented as
pointers to resizeable buffers, but Nim requires copying for
pointers to resizable buffers, but Nim requires copying for
assignments. Apart from RTTI the compiler also generates copy procedures
as a specialization.

We already know the type information as a graph in the compiler.
Thus we need to serialize this graph as RTTI for C code generation.
Thus, we need to serialize this graph as RTTI for C code generation.
Look at the file ``lib/system/hti.nim`` for more information.


Expand All @@ -418,7 +418,7 @@ Magics and compilerProcs
The `system` module contains the part of the RTL which needs support by
compiler magic. The C code generator generates the C code for it, just like any other
module. However, calls to some procedures like `addInt` are inserted by
the generator. Therefore there is a table (`compilerprocs`)
the generator. Therefore, there is a table (`compilerprocs`)
with all symbols that are marked as `compilerproc`. `compilerprocs` are
needed by the code generator. A `magic` proc is not the same as a
`compilerproc`: A `magic` is a proc that needs compiler magic for its
Expand Down Expand Up @@ -524,7 +524,7 @@ This should produce roughly this code:
proc add(x: int): tuple[prc, data: EnvX] =
var ex: EnvX
ex.x = x
result = (labmdaY, ex)
result = (lambdaY, ex)

var tmp = add(2)
var tmp2 = tmp.fn(4, tmp.data)
Expand Down Expand Up @@ -566,12 +566,12 @@ Internals
---------

Lambda lifting is implemented as part of the `transf` pass. The `transf`
pass generates code to setup the environment and to pass it around. However,
pass generates code to set up the environment and to pass it around. However,
this pass does not change the types! So we have some kind of mismatch here; on
the one hand the proc expression becomes an explicit tuple, on the other hand
the tyProc(ccClosure) type is not changed. For C code generation it's also
important the hidden formal param is `void*`:c: and not something more
specialized. However the more specialized env type needs to passed to the
specialized. However, the more specialized env type needs to passed to the
backend somehow. We deal with this by modifying `s.ast[paramPos]` to contain
the formal hidden parameter, but not `s.typ`!

Expand All @@ -586,14 +586,14 @@ Integer literals
----------------

In Nim, there is a redundant way to specify the type of an
integer literal. First of all, it should be unsurprising that every
integer literal. First, it should be unsurprising that every
node has a node kind. The node of an integer literal can be any of the
following values::

nkIntLit, nkInt8Lit, nkInt16Lit, nkInt32Lit, nkInt64Lit,
nkUIntLit, nkUInt8Lit, nkUInt16Lit, nkUInt32Lit, nkUInt64Lit

On top of that, there is also the `typ` field for the type. It the
On top of that, there is also the `typ` field for the type. The
kind of the `typ` field can be one of the following ones, and it
should be matching the literal kind::

Expand Down
Loading

0 comments on commit b4157f6

Please sign in to comment.