hi, 2010/2/26, Sam Wilson <[email protected]>: > Hey! > > I am just wondering if there is any syntactic sugar for shortening the > following code segment > > [code] > Element? nsource = ElementFactory.make("filesrc", "file-source"); > if (nsource == null) { printError(); return; } > Element source = (Element)nsource; > [/code] I beleive that last line can become var source = (!) nsource; and I even think the intended behaviour (right now it's a TODO in vala source) of non-null cast is to be like this (if the var is null, log a critical warning and return), so at some point, you should be able to write this in one line (assuming you beleive the returned value should be non null for your aguments).
HTH, Abderrahim _______________________________________________ Vala-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/vala-list
