Email or username:

Password:

Forgot your password?
Vala

Todays Vala feature you didn't know about!
This is how easy it is to work with *Glib.Variant*
#Vala #ValaLang

3 comments
Tor.sh :fedora: :silverblue:

@vala_lang What is the difference using this vs doing 'var' ?

GeopJr

@torbuntu GLib.Variant is a generic variable type that can represent anything from strings to arrays or unions. They are used mostly when interacting with the bindings or other services (like actions). You probably don't want to use them unless you plan to pass them to the bindings etc. Vala's post shows how easy it is to cast them to vala-native types, if you are working with them!

Here's an example: valadoc.org/gio-2.0/GLib.Simpl
That signal's value can be anything, you have to cast that Variant to the vala-native type it represents to use it

@torbuntu GLib.Variant is a generic variable type that can represent anything from strings to arrays or unions. They are used mostly when interacting with the bindings or other services (like actions). You probably don't want to use them unless you plan to pass them to the bindings etc. Vala's post shows how easy it is to cast them to vala-native types, if you are working with them!

Go Up