Project

General

Profile

Feature #12933

Add Some and Optional

Added by saveav (Adam Pahlevi Baihaqi) over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:78118]

Description

What if we have Optional and None as a class, and which we can use like this:

have_data = Optional(5).get # returns 5
have_data = Some(nil) # raise error
have_data = Some(operation).expect("cannot be nil") # raise cannot be nil if operation returned nil

History

Updated by saveav (Adam Pahlevi Baihaqi) over 2 years ago

  • Tracker changed from Bug to Feature

Change to feature from bug

Updated by matz (Yukihiro Matsumoto) about 2 years ago

  • Status changed from Open to Closed

I think it should be implemented in gem (at least for the beginning).
After the gen got popular, we can consider making it standard.

Matz.

Also available in: Atom PDF