Keeps track of the current error variable at compile time,
instead of using a pointer to the error variable at runtime.
Employs a trick with an unused type parameter to ensure that
invocations of the bindFailed() macro are expanded after
captureBindError() is expanded.
* Support for .?[] operator on openArrays
* Operator .?[] evaluates openArray expression only once
* Fix for Nim 1.2.x
---------
Co-authored-by: Mark Spanbroek <mark@spanbroek.net>
* tuple binding and unpacking support
* support tuple binding in nim < 1.6
* Use ? instead of Option[] in tests
* Test binding of optional tuple, not just tuple
* Add tests for tuple unpacking of Result
* Remove unused import
* Rearrange tuple binding code
Introduce separate proc for creation of unpacking
statement.
Use `quote do` to make code as similar as possible
to the `bindLet` and `bindVar` templates.
* Add tests for failed tuple bindings
---------
Co-authored-by: Mark Spanbroek <mark@spanbroek.net>
In rare instances, the Nim compiler will generate the same
symbol more than once. Adding a block works around this issue.
Reproducing this behavior in a unit test has proved elusive.
Give a clear compiler error when questionable
is used with the -d:nimPreviewDotLikeOps flag.
Reason: the option is likely to be deprecated
or removed. More info:
https://github.com/nim-lang/Nim/pull/19919
`errorban` module [has been deprecated][deprecation] since v0.5.0.
The library continued to use it internally, but because of that, it
was triggering its own deprecation warning. This commit splits
`errorban.nim` into two pieces: the warning and actual code.
[deprecation]: https://github.com/status-im/questionable/commit/e66cd2439b
Chaining operator is now `.?`
Indexing operator is now `.?[]`
Reason: interoperability with the binding `=?` operator.
Chaining and indexing now have lower operator precedence
than binding, ensuring that expressions such as `if a =? b.?c`
work as expected.