Core Data-Structures
Core data-structures are automatically loaded when you load Sq
.
Sq::Core::Option
This module is automatically available under the package Option
.
An Option
is the idea to represent a value or not. It's an alternative to using undef
. An Option
is an object that has certain methods on it and makes typical code that crashes when using undef
impossible.
Sq::Core::Result
This module is automatically available under the package Result
.
An Result
is the idea to represent an Ok
value or an Err
. Different to an Option
is that both cases can contain data. An Ok(1)
is different to an Err(1)
even when both contain a 1
.
A Result
is a another way to represent functions that either can be Ok
or returns an Err
or. Instead of just returning undef
or throwing Exceptions.