[Vala] Using 'as' for casting?
- From: Daniel Svensson <dsvensson gmail com>
- To: vala-list gnome org
- Subject: [Vala] Using 'as' for casting?
- Date: Fri, 7 Aug 2009 17:19:12 +0200
When converting my application to use Gtk.Builder I ended up with a
lot of code like this:
var lbl = builder.get_object("foo") as Gtk.Label;
And this caused me to try the following:
var time = Time.gm (unxtime as time_t);
as it was more readable than:
var time = Time.gm ((time_t) unxtime);
This however is not valid syntax, but maybe it should be? On IRC I got
the answer that if an 'as' would fail it would return null, and that's
why it shouldn't work.
I thought it was best to drop a mail to the list and see what people think.
--
Daniel Svensson
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]