[ruby-core:78118] [Ruby trunk Bug#12933] Add Some and Optional
From:
adam.pahlevi@...
Date:
2016-11-14 06:18:55 UTC
List:
ruby-core #78118
Issue #12933 has been reported by Adam Pahlevi Baihaqi.
----------------------------------------
Bug #12933: Add Some and Optional
https://bugs.ruby-lang.org/issues/12933
* Author: Adam Pahlevi Baihaqi
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v:
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
What if we have Optional and None as a class, and which we can use like this:
```ruby
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
```
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>