Skip to content

[Feature] #unwrap_optional helper #2970

Description

@amomchilov

It's a really common operation to unwrap the optionality out of a type, e.g. turning String? into String.

I'd propose (in psuedocode):

interface RBS::Types::_TypeBase
  # @overridable
  #: -> _TypeBase
  def unwrap_optional
    self # not optional, nothing to unwrap.
  end
end

class RBS::Types::Optional
  # @override
  #: -> _TypeBase
  def unwrap_optional
    type
  end
end

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions