Commit Graph

20 Commits

Author SHA1 Message Date
Ivan Bobev
cc65ae6011 Change UnpackError with UnpackDefect (#14457)
* 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.
2020-05-27 08:34:13 +02:00
cooldome
6635874a85 make get for options use lent T (#14442)
Co-authored-by: cooldome <ariabushenko@bk.ru>
2020-05-25 15:31:02 +02:00
Mamy Ratsimbazafy
f71f8b0239 The whole options module should be inline (#14417) [backport:1.2]
* The whole options module should be inline

* Use inline per proc and tag `lent` where appropriate

* Remove lent annotation (failing at compiletime)
2020-05-21 17:52:40 +02:00
Jacek Sieka
7d6cbf290a Error -> Defect for defects (#13908)
* 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.
2020-04-28 19:56:01 +02:00
hlaaftana
1276e386fe Consider proc as a pointer type in options (#13460)
* 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
2020-02-21 23:14:55 +01:00
narimiran
5732bb41ef [backport] run nimpretty on the remaining files 2019-09-30 13:58:17 +02:00
Yuriy Glukhov
d53ab9e5c8 Prevent options from calling custom ref == operators (#10745) 2019-02-26 15:43:34 +01:00
Miran
cedf784751 better docs: options (#10720) 2019-02-22 12:28:00 +01:00
Oscar Nihlgård
0a749f1a37 Make options.UnpackError inherit from system.Defect 2018-12-08 10:04:53 +01:00
Arne Döring
ce4383be3b fixes #8658; addQuoted on Option[T] (#8659) 2018-08-17 01:24:28 +02:00
Dominik Picheta
feda366d86 Adds get for Option[T]. (#8462) 2018-08-14 01:09:08 +02:00
Quelklef
ac3c4a94ad Fixed $ on None[T] for T with .name (#8293) 2018-07-12 11:01:48 +02:00
alaviss
26d89fa09c options: use isSome (#7782)
Fixes #7780
2018-05-06 10:55:19 +02:00
hlaaf
38b2596ff9 Add none[T]() as alias to none(T) (#7512)
* Add none[T]() as alias to none(T)

* Add tests for none[T]

* this test shouldn't work anyway
2018-04-16 21:01:37 +02:00
Arne Döring
e7edc7ec7f option optimization (#6253) 2018-04-11 16:50:27 +02:00
Euan T
4617114453 Fix documentation for the $ proc on an option (#6449) 2017-10-02 16:11:53 +02:00
Zach Smith
7abad507c9 Add flatMap operator to Options (#6404)
* 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
2017-09-27 21:55:55 +01:00
def
93e01da671 Fix options module to use new import name 2015-11-23 16:30:18 +01:00
Nycto
6fa01e3490 Extend option functionality 2015-09-23 08:52:51 -07:00
Flaviu Tamas
0479831fb0 Rename optionals module to options 2015-05-26 16:48:17 -04:00