[Vala] [PATCH] Allowing regex literals as case labels in switch statements



https://bugzilla.gnome.org/show_bug.cgi?id=624673

This is a patch to add this feature, borrowed from Ruby. Now you can say things
like:

var language = "vala";
switch (language) {
    case "C":
        print("boring\n");
        break;
    case /^C[+#]+$/:
        print("still boring\n");
        break;
    case /[lv]a[lv]a/:
        print("OMG LAVA! RUN!\n");
        break;
}

Please consider for inclusion in the next release.

Cheers,
Carlo




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