maybe: allows optional chaining of field access and indexing when LHS i snil (#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
This commit is contained in:
parent
e11ecc8266
commit
f6ba4e81b0
4 changed files with 196 additions and 0 deletions
|
|
@ -55,6 +55,10 @@
|
|||
|
||||
- Added `times.fromUnixFloat,toUnixFloat`, subsecond resolution versions of `fromUnix`,`toUnixFloat`.
|
||||
|
||||
- Added `wrapnils` module for chains of field-access and indexing where the LHS can be nil.
|
||||
This simplifies code by reducing need for if-else branches around intermediate maybe nil values.
|
||||
Eg: `echo ?.n.typ.kind`
|
||||
|
||||
## Library changes
|
||||
|
||||
- `asyncdispatch.drain` now properly takes into account `selector.hasPendingOperations`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue