Skip to content

Feature: Optional monad #5

@shortercode

Description

@shortercode

Description

As an alternative to having a 'null' value within the language is to use the 'Optional' monad. In both swift and Rust this is implemented as a generic enum with 2 variants: 'some' and 'none'. By encoding the null state into the type explicit unwrapping is required, making it harder to misuse the type in the way which older languages don't offer protection for.

While this could be implemented by the user it makes sense to include it as part of the standard library so that language features can utilise it.

This depends on the implementation of #4 and #2

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions