summary refs log tree commit diff stats
path: root/lib/std
Commit message (Collapse)AuthorAgeFilesLines
* implements https://github.com/nim-lang/RFCs/issues/258 (#15503)Andreas Rumpf2020-10-061-4/+39
| | | | | | | | | * implements https://github.com/nim-lang/RFCs/issues/258 * don't be too strict with custom pragma blocks * cast pragmas: documentation * added most missing inference query procs to effecttraits.nim
* Added std/effecttraits.nim (#15462)Andreas Rumpf2020-10-021-0/+19
|
* add `enumerate` macro (#15297)Miran2020-09-221-0/+56
| | | | | | | * add `enumerate` macro * address the comments * put `enumerate` in its own module
* Add some enhancements to `jsonutils.nim` (#15133)Ivan Bobev2020-09-091-31/+247
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add some enhancements to `jsonutils.nim` * Use `jsonutils.nim` hookable API to add a possibility to deserialize JSON arrays directly to `HashSet` and `OrderedSet` types and respectively to serialize those types to JSON arrays. * Also add a possibility to deserialize JSON `null` objects to Nim option objects and respectively to serialize Nim option object to JSON object if some or to JSON `null` object if none. * Move serialization/deserialization functionality for `Table` and `OrderedTable` types from `jsonutils.nim` to `tables.nim` via the hookable API. * Add object `jsonutils.Joptions` and parameter from its type to `jsonutils.fromJson` procedure to control whether to allow deserializing JSON objects to Nim objects when the JSON has some extra or missing keys. * Add unit tests for the added functionalities to `tjsonutils.nim`. * improve fromJsonFields * Add changelog entry for the jsonutils enhancements * Add TODO in `jsonutils.nim` * Added an entry to "Future directions" section in `jsonutils.nim` as suggestion for future support of serialization and de-serialization of nested variant objects. * Added currently disabled test case in `tjsonutils.nim` for testing serialization and de-serialization of nested variant objects. * Move JSON hooks to `jsonutils.nim` Move `fromJsonHook` and `toJsonHook` procedures for different types to `jsonutils.nim` module to avoid a dependency of collections modules to the `json.nim` module. The hooks are removed from the following modules: * `tables.nim` * `sets.nim` * `options.nim` * `strtabs.nim` * Add some tests about `StringTableRef` Add tests for `StringTableRef`'s `fromJsonHook` and `toJsonHook` to `tjsonutils.nim`. * Disable a warning in `jsonutils.nim` Mark `fun` template in `jsonutils` module with `{.used.}` pragma in order to disable `[XDeclaredButNotUsed]` hint. The template is actually used by the `initCaseObject` macro in the same module. Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* std/with support field assign (#14484)slangmgh2020-08-152-13/+19
| | | | | | | | | | | | | | | | | | | | | * std/with support filed assign * add changelog * add support x.dup.with * add example * revert support x.dup.with; add example * update changelog; fix assignment in parameter * Update changelog.md * add example for assignment in parameter * Remove colon style assign Co-authored-by: Clyybber <darkmine956@gmail.com>
* 'isolate' builtin; refs https://github.com/nim-lang/RFCs/issues/244 (#15011)Andreas Rumpf2020-07-201-0/+31
|
* fix #14475; unittest.require now works with `nim c`; require and check now ↵Timothee Cour2020-07-141-0/+22
| | | | | | | | | | | | | works with -d:nodejs (#14676) * fix #14475; make unittest work with -d:nodejs * fixup * fixup * disable inim, delaunay which failed after unittest.require got fixed * re-enable tests that have been fixed
* fromJson: support object variants (#14694)Timothee Cour2020-06-241-15/+73
|
* CI: Install the pkg we cloned (#14770)Clyybber2020-06-241-32/+0
|
* init checks and 'out' parameters (#14521)Andreas Rumpf2020-06-231-3/+3
| | | | | | | | | | | * I don't care about observable stores * enforce explicit initializations * cleaner code for the stdlib * stdlib: use explicit initializations * make tests green * algorithm.nim: set result explicitly * remove out parameters and bring the PR into a mergable state * updated the changelog
* `addQuitProc` now works with closures, and c, js(node/browser) backend; fix ↵Timothee Cour2020-06-161-0/+65
| | | | | | | | | | | | | | | some bugs in testament (#14342) * make addQuitProc great again * fix bugs in testament * fix test * change 2016 => 2020 * addQuitProc => addExitProc + locks * move to std/exitprocs
* make `fromJson/toJson` work with `array[range, typ]`, + 1 bugfix (#14669)Timothee Cour2020-06-151-8/+24
| | | | | * make toJson more robust * properly handle array
* Make the example better describe the desired outcome (#14611)Max Grender-Jones2020-06-081-5/+5
|
* optimized wrapWords; fixes #14579 (#14606) [backport:1.2]Andreas Rumpf2020-06-081-25/+48
|
* `toJson`, `jsonTo`, json (de)serialization for custom types; remove ↵Timothee Cour2020-06-081-0/+126
| | | | | | | | | | | | | | | | | | | | | dependency on strtabs thanks to a hooking mechanism (#14563) * json custom serialization; application for strtabs * serialize using nesting * make toJson more feature complete * add since * Revert "Improve JSON serialisation of strtabs (#14549)" This reverts commit 7cb4ef26addb3bb5ce2405d8396df6fd41664dae. * better approach via mixin * toJson, jsonTo * fix test * address comments * move to jsonutils * doc * cleanups * also test for js * also test for vm
* fix https://github.com/timotheecour/Nim/issues/266 retry on failure to avoid ↵Timothee Cour2020-06-021-0/+32
| | | | common 503 github errors (#14547)
* walkDirRecFilter, update doc CI filter, compiler/index.nim for docs + ↵Timothee Cour2020-06-011-0/+54
| | | | | | | | | | | various other fixes (#14501) * update doc CI filter to include the files mostly likely to require doc rebuild * remove code duplication in ./config/nimdoc.cfg; show link to compiler docs, various fixes * walkDirRecFilter, factor nativeToUnixPath workaround * glob for getRst2html * docslocal: 40s to build all docs * revert code dedup in github actions which did not work alas... * fixups
* fix CI doc windows: style error in lib/std/time_t.nim (#14523)Timothee Cour2020-05-311-2/+2
|
* `nim doc --backend:js`, `nim doc --doccmd:-d:foo`, `nim r --backend:js`, ↵Timothee Cour2020-05-111-0/+2
| | | | | | | | | | `--doccmd:skip` + other improvements (#14278) * `nim doc --backend:js|cpp...` `nim doc --doccmd:'-d:foo --threads:on'` `nim r --backend:cpp...` (implies --run --usenimcache) * --usenimcache works with all targets * --docCmd:skip now skips compiling snippets; 50X speedup for doc/manual.rst
* fix js stacktraces, unify all file,line,col formatting into a single ↵Timothee Cour2020-05-051-0/+15
| | | | | function (#14230) * fix https://github.com/timotheecour/Nim/issues/135 ; unify all file,line,col formatting into a single function
* move since from inclrtl to std/private/since (#14188)hlaaftana2020-05-021-0/+19
| | | | * move since from inclrtl to std/private/since * move since import in system below for HCR
* Error -> Defect for defects (#13908)Jacek Sieka2020-04-281-1/+1
| | | | | | | | | | | | | | * Error -> Defect for defects The distinction between Error and Defect is subjective, context-dependent and somewhat arbitrary, so when looking at an exception, it's hard to guess what it is - this happens often when looking at a `raises` list _without_ opening the corresponding definition and digging through layers of inheritance. With the help of a little consistency in naming, it's at least possible to start disentangling the two error types and the standard lib can set a good example here.
* Make unused code into actual test, replace echo with doassert (#13952)Juan Carlos2020-04-111-33/+0
|
* std/byaddr => std/decls (#13847)Timothee Cour2020-04-031-0/+0
|
* renamed new std/pragmas.nim to std/byaddr.nim (#13844)Andreas Rumpf2020-04-021-5/+5
| | | | | * renamed new std/pragmas.nim to std/byaddr.nim * minor code cleanup
* DrNim (Nim compiler with Z3 integration) (#13743)Andreas Rumpf2020-03-311-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | * code cleanups and feature additions * added basic test and koch/CI integration * make it build on Unix * DrNim: now buildable on Unix, only takes 10 minutes, enjoy * added basic documentation for DrNim which can also be seen as the RFC we're following * drnim: change the build setup so that drnim.exe ends up in bin/ * makes simple floating point ranges work * added basic float range check * drnim: teach Z3 about Nim's range types plus code refactoring * drnim: make unsigned numbers work * added and fixed index checking under setLen * first implementation of .ensures, .invariant and .assume (.requires still missing and so is proc type compatibility checking * drnim: .requires checking implemented * drnim: implemented .ensures properly * more impressive test involving min() * drnim: check for proc type compatibility and base method compatibility wrt .requires and .ensures * testament: support for 'pattern <directory> * koch: uses new <directory> feature of testament * drnim: added tiny musings about 'old' * Make testament work with old SSL versions * koch: add support for 'koch drnim -d:release' * drnim: preparations for the param.old notation
* Add Documentation (#13811)Juan Carlos2020-03-312-1/+11
| | | | * Add more Docs and runnableExamples
* stacktraces can now show custom runtime msgs per frame (#13351)Timothee Cour2020-03-301-0/+30
| | | | | | | | * stacktraces can now show custom runtime msgs * improve tests/stdlib/tstackframes.nim * fix test for --gc:arc * test --stacktraceMsgs:on and --stacktraceMsgs:off * --stacktracemsgs:off by default
* new syntax for lvalue references: `var b {.byaddr.} = expr` (#13508)Timothee Cour2020-03-231-0/+19
| | | | | | | | * new syntax for lvalue references: `var b {.byaddr.} = expr` * on type mismatch, `???(0, 0)` not shown anymore * * compiler now lowers `var a: {.foo.}: MyType = expr` to foo(a, MyType, expr) * new pragmas.byaddr defined in pure library code exploiting this lowering * skip `template foo() {.pragma.}`
* fixes a bug for 'dup' and 'with'; they can now handle nested statement lists ↵Araq2020-03-172-17/+21
| | | | that can result from macros
* std/compilesettings implementation (#13584)Andreas Rumpf2020-03-041-0/+54
| | | | | | | | * Implement compileSetting() and compileSettingSeq() * Change from magic to vmop * better design for querySetting Co-authored-by: genotrance <dev@genotrance.com>
* added operateOn to sugar.nim to give Nim the chaining mechanism it de… ↵Andreas Rumpf2020-02-262-0/+96
| | | | | | | | (#13092) * implemented the with stdlib module as specified in https://github.com/nim-lang/RFCs/issues/193 * change sugar.outplace to sugar.dup according to https://github.com/nim-lang/RFCs/issues/193 * changelog update
* make monotimes have zero overhead if you don't use it (#13338) [backport]Andreas Rumpf2020-02-061-10/+6
|
* maybe: allows optional chaining of field access and indexing when LHS i snil ↵Timothee Cour2020-01-181-0/+109
| | | | | | | | | (#13023) * maybe: allows optional chaining * fix tools/kochdocs.nim * improve semantics to distinguish valid from invalid values * for now, wrapnil, isValid, unwrap are not exported
* style fix: change 'JS' to 'js' to make it consistent (#13168)Miran2020-01-161-2/+2
|
* remove deprecated procs (#12535)Andreas Rumpf2019-11-051-0/+10
|
* fix conversions to uint in varints.nim (#12564)Arne Döring2019-11-041-22/+22
|
* Fix many broken links and prefer relative links within docs (#12463)Miran2019-10-241-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix many broken links Note that contrary to what docgen.rst currently says, the ids have to match exactly or else most web browsers will not jump to the intended symbol. * Prefer relative links for Nim documentation This is more friendly to those browsing the documentation without a network connection. The nim-doc package in Debian allows this, for example. Also, the domain name being used was not consistent. It could have been either nim-lang.org or nim-lang.github.io, and those reading the stable docs could have found themselves suddenly reading the devel docs instead. * koch.rst: remove link to nonexistent section * manual.rst: remove unintended link cast[T](0) is interpreted as a link to id 0 with text T, so escape the opening parentheses to display the intended output. * asyncstreams: replace unintended link with emphasis * Fix word wrapping
| * Fix many broken linksJjp1372019-10-221-3/+3
| | | | | | | | | | | | Note that contrary to what docgen.rst currently says, the ids have to match exactly or else most web browsers will not jump to the intended symbol.
* | Fix JS bug in std/monotimes (#12499) [backport]Oscar Nihlgård2019-10-241-1/+2
|/
* Fix spellings (#12277) [backport]Federico Ceratto2019-09-271-1/+1
|
* last stdlib cleanupsAraq2019-09-211-1/+3
|
* [feature] Added std/monotimesOscar Nihlgård2019-07-121-0/+173
|
* there is only one style -- my styleAraq2019-07-101-58/+58
|
* make editdistance work with --styleCheck:errorAraq2019-07-101-108/+108
|
* Make public additional types from sha1 module [feature] (#11694)Ivan Bobev2019-07-101-2/+2
| | | | | | | | | | * Make public additional types from sha1 module After making public newSha1State, update and finalize methods from the sha1 module was forgotten to be made public Sha1Digest and Sha1State types used by the new public methods. * Update changelog.md with sha1 module changes
* Make public some sha1 module procedures (#11655) [feature]Ivan Bobev2019-07-041-3/+3
| | | | | Make "newSha1State", "update" and "finalize" procedures from the sha1 module public in order to be possible to compute single sha1 hash of multiple separate blocks of data.
* Make `secureHash` accept any `openArray[char]`, not only `string`. (#10988)c-blake2019-04-101-1/+1
| | | | | | * Make `secureHash` accept any `openArray[char]`, not only `string`. * Put in a changelog entry as per Araq request.
* Add summation algorithms (#9284)b3liever2019-02-131-0/+78
|
* better docs: sha1 (#10374)Thomas T. Jarløv2019-01-191-1/+64
|