On Fri, 2010-02-26 at 00:43 +0100, Jiří Zárevúcky wrote:
Here's a little trick you might like: [code] errordomain MyError { FAILED; } T throwerror<T> (string str) throws Error { throw new MyError.FAILED (str); } int func () { int? i = null; int j = i ?? throwerror<int> ("hello"); return j; } [/code]
Looks great, but I can't get it to compile with experimental non null since the ?? operator is returning an 'int?' IMHO, as nice as this solution is, it seems a bit hackish for a language that claims to support non-null types. Overall, Vala provides very few features that make N.N. types more attractive compared to regular types and personally I find them a pain to work with
Attachment:
smime.p7s
Description: S/MIME cryptographic signature