summary refs log tree commit diff stats
path: root/lib/pure/options.nim
Commit message (Collapse)AuthorAgeFilesLines
* make `std/options` compatible with strictdefs (#23675)ringabout2024-06-051-6/+6
|
* fixes #22932; treats closure iterators as pointers (#22934)ringabout2023-11-141-2/+2
| | | | | | | | fixes #22932 follow up https://github.com/nim-lang/Nim/pull/21629 --------- Co-authored-by: Nickolay Bukreyev <SirNickolas@users.noreply.github.com>
* complete std prefixes for stdlib (#22887)ringabout2023-10-301-1/+1
| | | | follow up https://github.com/nim-lang/Nim/pull/22851 follow up https://github.com/nim-lang/Nim/pull/22873
* fixes #22836; Unnecessary warning on 'options.none' with 'strictDefs'… ↵ringabout2023-10-181-1/+1
| | | | | | | (#22837) … enabled fixes #22836
* Markdown code blocks migration part 8 (#22478)Andrey Makarov2023-08-151-1/+2
|
* std/options enables stricteffects (#19441)ringabout2022-08-251-4/+8
|
* move assertions out of system (#19599)flywind2022-03-231-0/+4
|
* Add sink annotation to option some() (#18358)tomc19982021-06-251-2/+2
|
* CIs: attempt to use csources_v1 (#16282)Andreas Rumpf2021-04-211-1/+1
| | | | | | | | * CIs: attempt to use csources_v1 * also updated the BSDs * also updated azure pipelines * std modules should not itself use the 'std/' import dir... * compiler has to be careful with std/ for v1 booting
* `std/options`: `$some(3)` is now `"some(3)"`, etc. (#17147)Timothee Cour2021-02-241-9/+15
| | | | | | | * std/options: $some(3) is now "some(3)", not "Some(3)", `$none(int)` is now `"none(int)"` instead of `"None[int]"` * fix tests * disable optionsutils
* Add example for pattern matching on options (#17120)konsumlamm2021-02-221-21/+49
| | | | | | | | | | | * Add example for pattern matching on options * Use code-block * Apply suggestions * Use block comments * Fix example
* Improve documentation for options (#17036)konsumlamm2021-02-181-130/+104
|
* use typeof instead type (#16962)flywind2021-02-081-2/+2
|
* use runnableExamples in options (#16503)flywind2020-12-301-26/+17
|
* move tests to testament (#16101)flywind2020-11-241-141/+0
| | | | | | | | | * move tests to testament * minor * fix random * disable test random
* Add some enhancements to `jsonutils.nim` (#15133)Ivan Bobev2020-09-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Use more `lent` in options (#15208)Mamy Ratsimbazafy2020-08-241-2/+2
|
* Change `UnpackError` with `UnpackDefect` (#14457)Ivan Bobev2020-05-271-6/+6
| | | | | | | | | | | | | | | | | | * Change `UnpackError` with `UnpackDefect` The deprecation warning for `UnpackError` exception raised by some `inline` procedures in the Nim standard library propagates to the user code. If the user code has a requirement for building without warnings this is a problem for the successful execution of the tests. In order to resolve this, all occurrences of `UnpackError` in the Nim code base are changed to `UnpackDefect`. Only the type alias is retained to not break other people's user code since `UnpackError` is exported type. * Remove the catching of `UnpackDefect` Defect exceptions should not be cached, because they indicate problem in the API usage. The code in `nimblesocket.nim` is rewritten to first check whether there is a value set into the `knownDomain` variable from the `Option` type before usage.
* make get for options use lent T (#14442)cooldome2020-05-251-2/+2
| | | Co-authored-by: cooldome <ariabushenko@bk.ru>
* The whole options module should be inline (#14417) [backport:1.2]Mamy Ratsimbazafy2020-05-211-15/+14
| | | | | | | * The whole options module should be inline * Use inline per proc and tag `lent` where appropriate * Remove lent annotation (failing at compiletime)
* Error -> Defect for defects (#13908)Jacek Sieka2020-04-281-3/+3
| | | | | | | | | | | | | | * 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.
* Consider proc as a pointer type in options (#13460)hlaaftana2020-02-211-3/+12
| | | | | | | | * Consider proc as a pointer type in options * Add version annotation for SomePointer having proc in options * Log procs as pointers for options in changelog
* [backport] run nimpretty on the remaining filesnarimiran2019-09-301-2/+3
|
* Prevent options from calling custom ref == operators (#10745)Yuriy Glukhov2019-02-261-3/+18
|
* better docs: options (#10720)Miran2019-02-221-54/+226
|
* Make options.UnpackError inherit from system.DefectOscar Nihlgård2018-12-081-19/+15
|
* fixes #8658; addQuoted on Option[T] (#8659)Arne Döring2018-08-171-3/+5
|
* Adds get for Option[T]. (#8462)Dominik Picheta2018-08-141-1/+8
|
* Fixed $ on None[T] for T with .name (#8293)Quelklef2018-07-121-1/+15
|
* options: use isSome (#7782)alaviss2018-05-061-4/+4
| | | Fixes #7780
* Add none[T]() as alias to none(T) (#7512)hlaaf2018-04-161-0/+8
| | | | | | | | * Add none[T]() as alias to none(T) * Add tests for none[T] * this test shouldn't work anyway
* option optimization (#6253)Arne Döring2018-04-111-15/+49
|
* Fix documentation for the `$` proc on an option (#6449)Euan T2017-10-021-1/+4
|
* Add flatMap operator to Options (#6404)Zach Smith2017-09-271-24/+57
| | | | | | | | | | | | * Add >>= operator to Options * options.bind callback signature: A -> Option[B] * Use `flatMap` as the name of the Option bind operation. * Rename Options test "bind" to "flatMap" * CR from @dom96: Remove spaces inside of check() call
* Fix options module to use new import namedef2015-11-231-2/+2
|
* Extend option functionalityNycto2015-09-231-1/+63
|
* Rename optionals module to optionsFlaviu Tamas2015-05-261-0/+160