Vala should implicitly cast string literals to GVariantType
Submitted by Allison (desrt)
Link to original bug (#645454)
Description
Vala should be capable of accepting a string literal and converting it directly to a GVariantType by use of a C language cast:
void a(VariantType v) { } void b() { a("a{sv}"); }
turns into:
void b (void) { a ((const GVariantType *) "a{sv}"); }
Of course, in order for this use to succeed, Vala would statically parse the string literal for validity as a GVariant type string. It could easily do this using the facilities within glib itself (so Vala wouldn't have to worry about maintaining and updating its own parser).
In addition to the less typing, this has two other advantages:
- less memory allocation and runtime checking -> faster
- turns dynamic errors into static errors -> better