Skip to content

Option value design #172

Description

@bvssvni

Dyon has no null value, but uses some(val) and none(). It has a lot of common with result value, but there are a few differences.

  • some(x)
  • none()
  • unwrap(some(x)) returns x
  • none()? propagates an error, returning from the function

The type of option is opt (any type) and opt[T].

This is designed for:

  • Explicitly declare when a value is optional
  • Check when mutating a variable that it also is optional
  • Convenient for debugging
  • Common way of handling errors

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions