Re: [Vala] [ANNOUNCE] Vala 0.7.8 - Compiler for the GObject type system



AFAIK the new syntax is as follows:


String templates
----------------

string name = "Vala";
stdout.printf (@"Hello, $name!\n");
stdout.printf (@"2 + 3 = $(2 + 3)\n");


Non-null cast
-------------

void main () {
        string? a = "hello";
        string b = a;
}

This won't compile with strict nullability checking enabled ('--enable-experimental-non-null'):

  error: Assignment: Cannot convert from `string?' to `string'

However, if you cast the nullable variable into a non-nullable variable
with '(!)' it will compile:

void main () {
        string? a = "hello";
        string b = (!) a;
}


Chain-up for gobject-style construction scheme
----------------------------------------------

Instead of assignment to construct-only properties:

class MyWindow : Gtk.Window {

        public MyWindow () {
                Object (type: WindowType.POPUP);
        }

        construct {
                // ...
        }
}



Best regards,

Frederik



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]