Menu

Tree [7575ec] default tip /
 History

Read Only access


File Date Author Commit
 docs 2025-10-23 ggb ggb [27c15f] Remove extraneous comment
 .hgignore 2025-09-01 ggb ggb [9faf7e] Updated README
 .hgtags 2025-10-23 ggb ggb [7575ec] Moved tag V0.16 to changeset 27c15f8d94b4 (from...
 README.md 2025-10-15 ggb ggb [7665a1] Added get() with default and a couple of minor ...
 docgen.sh 2025-09-01 ggb ggb [9faf7e] Updated README
 docs.html 2024-01-14 ggb ggb [b837fe] Enhanced operators '?' and '$'
 quad_states.nim 2025-10-23 ggb ggb [27c15f] Remove extraneous comment
 quad_states.nimble 2025-10-22 ggb ggb [b5689f] Added borrows to distinct types

Read Me

Quad States

This is a utility function for development in the nim language.

This was originally intended to combine the functionality of Result[] and Option[] but has since been extended to give a more subtle mix of values.

As with Result and Option, the primary usage of these data values is to return state conditions from proc and func mostly
obviating the need to raise exceptions to return abnormal state conditions.

The various return data types are:

QOption:

  • This is equivalent to Option and allows a value of nothing (None).

QResult:

  • This is equivalent to Result and allows a return value or an error value to be returned.

  • QTResult:

    • This is QResult but the error value is restricted to being a string (text) value.

QValid:

  • This allows a return type to indicate the process was valid (but had no need to actually return any data upon a valid completion), or it can return an error condition indication the nature of the failure within the process.

  • QTValid:

    • This is QValid but the error value is restricted to being a string (text) value.

QValue

  • This combines QResult and QOption (i.e. it can return a value, and error, or neither.

  • QTValue:

    • This is QValue but the error value is restricted to being a string (text) value.

The states returned are:

Value:

  • This indicates that a valid data value is available.
  • This state can be returned with QOption or QResult or QValue.

Error:

  • This indicates that an error occurred.
  • This state can be returned with QResult or QValid or QValue.

None:

  • This indicates that no data value is available but neither is there a specific error condition.
  • This state can be returned with QOption or QValue.

Valid:

  • This indicates that no error occurred but there is not any actual data value to return.
  • This state can only be returned with QValid.

More details can be found in the code comments or the documentation that can be generated from those comments.

Installation

    nimble install "http://hg.code.sf.net/p/nim-quad-states/code"
MongoDB Logo MongoDB