Commit Graph

2045 Commits

Author SHA1 Message Date
Juan Carlos
a90e687d26 Document move limitations (#23763)
- See
https://github.com/nim-lang/Nim/issues/23759#issuecomment-2192123783

(cherry picked from commit 179897e55f)
2024-06-29 12:57:47 +02:00
Antonis Geralis
8f5451832e Add a note about the sideeffect pragma (#23543)
(cherry picked from commit 63398b11f5)
2024-05-23 08:59:31 +02:00
yojiyama7
c5f2d84ac7 fix typo: "As can been seen" to "As can be seen" (#23544)
(cherry picked from commit 47594eb909)
2024-05-22 09:38:57 +02:00
arkanoid87
b3a62931cd Update manual.md (#23393)
adding link to generic == for tuples in Open and Closed symbols example

(cherry picked from commit cbf48a253f)
2024-05-21 14:52:29 +02:00
ringabout
11713ef018 remove obselete doc with nimrtl (#23358)
since nimrtl.dll is created with `--threads:on`

(cherry picked from commit a619434904)
2024-05-21 14:19:04 +02:00
Jacek Sieka
0cdca3a0cd Recommend hanging indent in NEP1 (#23105)
This PR modernises the NEP1 style guide to prefer hanging indent over
vertial alignment for long code statements while still allowing
alignment in legacy code.

The change is based on research and study of existing style guides for
both braced and indented languages that have seen wide adoption as well
as working with a large Nim codebase with several teams touching the
same code regularly.

The research was done as part of due diligence leading up to
[nph](https://github.com/arnetheduck/nph) which uses this style
throughout.

There are several reasons why hanging indent works well for
collaboration, good code practices and modern Nim features:

* as NEP1 itself points out, alignment causes unnecessary friction when
refactoring, adding/removing items to lists and otherwise improving code
style or due to the need for realignment - the new recommendation aligns
NEP1 with itself
* When collaborating, alignment leads to unnecessary git conflicts and
blame changes - with hanging indent, such conflicts are minimised.
* Vertical alignment pushes much of the code to the right where often
there is little space - when using modern features such as generics
where types may be composed of several (descriptively named) components,
there is simply no more room for parameters or comments
* The space to the left of the alignemnt cannot productively be used for
anything (unlike on the right, where comments may be placed)
* Double hanging indent maintaines visual separation between parameters
/ condition and the body that follows.

This may seem like a drastic change, but in reality, it is not:

* the most popular editor for Nim (vscode) already promotes this style
by default (if you press enter after `(`, it will jump to an indent on
the next line)
* although orthogonal to these changes, tools such as `nph` can be used
to reformat existing code should this be desired - when done in a single
commit, `git blame` is not lost and neither are exsting PRs (they can
simply be reformatted deterministically) - `nph` is also integrated with
vscode.
* It only affects long lines - ie most code remains unchanged

Examples of vertical alignment in the wild, for wildly successful
languages and formatters:

* [PEP-8](https://peps.python.org/pep-0008/#indentation)
*
[black](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#how-black-wraps-lines)
* [prettier](https://prettier.io/docs/en/)

The above examples are useful mainly to show that hanging-indent
_generally_ is no impediment to efficient code reading and on the whole
is an uncontroversial choice as befits the standard library.

(cherry picked from commit c4f98b7696)
2024-04-19 16:39:13 +02:00
Ryan McConnell
4f78a4dd3e Make typeRel behave to spec (#22261)
The goal of this PR is to make `typeRel` accurate to it's definition for
generics:
```
# 3) When used with two type classes, it will check whether the types
# matching the first type class (aOrig) are a strict subset of the types matching
# the other (f). This allows us to compare the signatures of generic procs in
# order to give preferrence to the most specific one:
```

I don't want this PR to break any code, and I want to preserve all of
Nims current behaviors. I think that making this more accurate will help
serve as ground work for the future. It may not be possible to not break
anything but this is my attempt.

So that it is understood, this code was part of another PR (#22143) but
that problem statement only needed this change by extension. It's more
organized to split two problems into two PRs and this issue, being
non-breaking, should be a more immediate improvement.

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
(cherry picked from commit b2ca6bedae)
2024-04-18 09:01:14 +02:00
metagn
3911c90d7b type annotations for variable tuple unpacking, better error messages (#22611)
* type annotations for variable tuple unpacking, better error messages

closes #17989, closes https://github.com/nim-lang/RFCs/issues/339

* update grammar

* fix test

(cherry picked from commit ba158d73dc)
2024-04-17 14:04:43 +02:00
Andreas Rumpf
fb2cc06557 destructors: better docs [backport:2.0] (#22391)
(cherry picked from commit 9872453365)
2024-04-17 09:36:34 +02:00
ringabout
d097028307 fixes a typo in the manual (#22383)
ref 0d3bde95f5 (commitcomment-122093273)

(cherry picked from commit 7c2a2c8dc8)
2024-04-17 09:35:58 +02:00
ringabout
569ccc50ff fixes #22174; fixes destructor examples (#22349)
* fixes #22174; fixes destructor examples

* Update doc/destructors.md

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-07-31 15:37:24 +02:00
Khaled Hammouda
dce714b259 Fix grammar top rule (#22325)
change stmt to complexOrSimpleStmt in the top grammar rule
2023-07-24 19:48:41 +02:00
Andreas Rumpf
be1844541c implemented 'push quirky' switch for fine grained control over the ex… (#22318)
* implemented 'push quirky' switch for fine grained control over the exception handling overhead

* documentation
2023-07-23 13:39:58 +02:00
konsumlamm
e2ea9140ac Document cast zeroing memory (#22313) 2023-07-22 21:11:49 +02:00
Ryan McConnell
0d3bde95f5 Adding info to manual (#22252)
* Adjustments

* Moving example

* typo

* adding code example back and fix terms

* Condensing
2023-07-19 15:04:14 +02:00
ringabout
1ad618d96c clean up the documentation (#22196) 2023-07-02 22:36:05 +02:00
心夏❤v
7cb59efd4b Tidy contributing.md: format cmd (#22204) 2023-07-01 16:16:59 +08:00
Juan M Gómez
d195877615 docs nimBasePattern (#22179) 2023-06-28 17:49:35 +02:00
Andreas Rumpf
d52b1d848e destructors: update, =destroy does not require a 'var T' (#22168) 2023-06-27 12:55:47 +02:00
ringabout
a345cde26e allow destructors to accept non var parameters; deprecate proc =destroy(x: var T) (#22130)
* make destructors accept non var parameters
* define nimAllowNonVarDestructor
* add a test case and a changelog
* update documentation and error messages
* deprecate destructors taking 'var T'
2023-06-21 08:51:03 +02:00
Andreas Rumpf
606e9941d0 better docs; undocument sinkInference as it doesn't work (#22089) 2023-06-13 13:44:41 +02:00
metagn
e0ad71a912 make binary not not parse complex expressions on right side (#22078)
* binary `not` only parses simple expressions

fixes #16324

* switch to primary
2023-06-12 06:22:50 +02:00
Andreas Rumpf
21d941c16a Atlas: now in its own repository (#22066)
* Atlas: now in its own repository

* progress
2023-06-10 17:32:11 +02:00
Juan Carlos
b2d7761975 Remove Deprecated Nimfix (#22062)
* Remove Deprecated Nimfix
* Trailing whitespace cleanups
2023-06-10 07:09:03 +02:00
Juan M Gómez
a7682325a2 fixes typos in the constructor docs (#22035)
* fixes typos in the constructor docs

* updates constructor docs

* Update doc/manual_experimental.md

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-06-09 09:55:24 +02:00
Antonis Geralis
750a33cbf1 Fix indentation in destructors.md (#22048) 2023-06-08 14:07:40 +02:00
Raynei
ba4fb21032 fixes #19086: Document exception and defect hierarchy (#22030)
* Documented exception and defect hierarchy (#19086)

* Fixed style
2023-06-08 06:55:17 +02:00
Juan M Gómez
134b1890d5 documents constructor (#22013)
* documents constructor

* Apply suggestions from code review

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-06-06 21:22:32 +02:00
metagn
2ab948ce53 post expr blocks colon fix + correct grammar (#21983)
* post expr blocks colon fix + correct grammar

fixes #21982

* fix dochelpers

* this is remarkably common

* use head for unchained

* fix atlas

* final grammar fix
2023-06-06 06:53:21 +02:00
ringabout
8cc49f221e update the documentation of the dup hook (#21984)
* update the documentation of the dup hook

* document `=dup`

* typo

* minor improvement

* typo

* Update doc/destructors.md

* Update doc/destructors.md

* Update doc/destructors.md

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-06-03 07:09:05 +02:00
Andreas Rumpf
a9385a6b4a Atlas: virtual environments (#21965)
* Atlas: virtual environments

* fixes
2023-05-30 18:02:55 +02:00
Andreas Rumpf
4d20227438 Atlas: URL rewrite rules; --autoinit flag (#21963) 2023-05-30 14:00:09 +02:00
Andreas Rumpf
7ebb042f79 Atlas: some final cleanups (#21947) 2023-05-28 18:18:30 +02:00
ringabout
c2abcb06cc ship atlas and build documentation (#21945)
* ship atlas and build documentation

* move atlas.md and link it in tools' index
2023-05-28 08:28:49 +02:00
heterodoxic
609bf3d7c8 fix #21501 by making --app:lib and --app:staticLib imply --noMain (#21910) 2023-05-26 03:20:56 +02:00
Juan M Gómez
ee3650b29e documents changes on byref and bycopy (#21882) 2023-05-22 17:39:54 +02:00
Juan M Gómez
fcf2dcf099 Moves virtual under its own section manual_experimental.md (#21870) 2023-05-20 23:52:21 +02:00
Juan M Gómez
21ff10b882 documents virtual (#21860)
* documents virtual

* Apply suggestions from code review

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-05-19 21:23:29 +02:00
Andreas Rumpf
f4a9b258c3 isolation spec update; WIP (#21843)
* isolation spec update; WIP

* wip

* docs update, WIP

* progress

* Update doc/manual.md
2023-05-14 16:58:28 +02:00
ringabout
3b9999b93c adds documentation for =wasMoved and =dup hooks and small fixes (#21827)
* adds documentation for `=wasMoved` and `=dup` hooks and small fixes

* Update doc/destructors.md

* Update doc/destructors.md

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-05-11 19:38:27 +08:00
Juan Carlos
3a08e2e6ac Remove LineTooLong (#21819)
* LineTooLong refactor to make it actually useful
* Improve error message
* changelog wording
* Fix typo
2023-05-11 10:10:51 +02:00
ringabout
71439c2891 fixes links of generic define pragma (#21828) 2023-05-11 15:00:30 +08:00
Juan M Gómez
e45eb39ef7 documents codegendecl for object types (#21811) 2023-05-08 17:04:27 +02:00
Tomohiro
10328e50a5 Document about size pragma (#21794)
* Document about size pragma

* Fix typos

* Fix manual.md

* Update doc/manual.md

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-05-06 12:03:45 +02:00
Daniel Belmes
85dbfc68b5 Update the Nim Manual compile pragma with the second tuple form (#21773)
* Update the nim manual compile pragma with the second tuple form of

* Incorrectly put 'two' forms
2023-05-05 14:27:33 +02:00
ringabout
1d80dc7df6 closes #21771; fixes the link (#21777)
closes #21771
2023-05-03 18:54:40 +08:00
Andreas Rumpf
220b450489 fixes #21245; warn about destructors that can raise (#21726)
* fixes #21245; warn about destructors that can raise

* doc update

* progress

* typo
2023-04-26 22:32:10 +02:00
Juan M Gómez
897dff69dd documents #21628 (#21723)
* documents #21628

* Update doc/manual.md

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-04-24 18:09:07 +02:00
metagn
63d29ddd69 alias syntax fixes, improvements and tests (#21671)
* alias syntax fixes, improvements and tests

* even better, cannot use alias syntax with generics

* more type tests, improve comment

* fix again

* consistent error message + make t5167_5 work

* more comments, remove {.noalias.}
2023-04-22 09:11:56 +02:00
Raynei
48de0d0cf4 Documented path substitution by compiler (#21662)
Document compiler path substitution (nim-lang#19928)
2023-04-21 15:37:21 +02:00