On Monday, 26 October 2015 at 16:42:27 UTC, TheFlyingFiddle wrote:
If you instead use pattern matching as in your example you have much better context information that can actually help you do something in the case a value is not there.
Probably possible: Some!T get(T)(Option!T item) { Some!T r; //Static guarantee of handling value not present item match { None() => { throw new Exception("empty!"); } Some(t) => { r=t; } } return r; } Then: Option!File file; Some!File s = file.get();