2015-01-13

Vala 0.27.1 released

The new development version 0.27.1 of the Vala programming language contains a lot of enhancements and bug fixes.

Release notes are the following:

Changes

  • Print compiler messages in color.
  • Add clutter-gdk-1.0 bindings.
  • Add clutter-gst-3.0 bindings.
  • Add clutter-x11-1.0 bindings.
  • Add rest-extras-0.7 bindings.
  • Bug fixes and binding updates.
However I'd like to tell more:
  • The compiler now checks for unknown attributes.
  • More checks in the compiler about invalid semantics.
  • Now XOR works with boolean, like bitwise OR and AND
  • A new attribute [ConcreteAccessor], mostly used for bindings. It's common that in C interface properties have concrete accessors instead of abstract accessors. Before this, you had [NoAccessorMethod] on top of such properties.
  • Sometimes the "type" property is used in projects but Vala could not support it. Now if the bindings have [NoAccessorMethod] you can use it.
  • We now infer generics recursively in method calls, so less typing for you.
  • And more.
Have fun.

2014-12-07

Vala deadlocks with glib 2.42

Since glib 2.41.2, the mutex/cond implementation on Linux has changed. The code compiled with Vala < 0.26 which targets at least glib 2.32 with --target-glib 2.32 will suffer from deadlocks.

Your options are either:
  • Do not --target-glib 2.32
  • Update Vala to at least 0.25.2
  • Instead of upgrading Vala, pick the bindings for Mutex and Cond from the new glib-2.0.vapi
  • Downgrade glib
To clarify, it's not a glib bug. It's an old valac bug in the glib-2.0.vapi bindings of Mutex and Cond  that became now critical after the glib implementation change.

The relevant Vala bug can be found here: https://bugzilla.gnome.org/show_bug.cgi?id=733500

2014-07-23

Vala 0.25.1 released

This new release of the Vala programming language brings a new set of features together with several bug fixes.

Changes

  • Support explicit interface method implementation.
  • Support (unowned type)[] syntax.
  • Support non-literal length in fixed-size arrays.
  • Mark regular expression literals as stable.
  • GIR parser updates.
  • Add webkit2gtk-3.0 bindings.
  • Add gstreamer-allocators-1.0 and gstreamer-riff-1.0 bindings.
  • Bug fixes and binding updates.
The explicit interface method implementation allows to implement two interfaces that have methods (not properties) with the same name. Example:

interface Foo {
 public abstract int m();
}

interface Bar {
 public abstract string m();
}

class Cls: Foo, Bar {
 public int Foo.m() {
  return 10;
 }

 public string Bar.m() {
  return "bar";
 }
}

void main () {
 var cls = new Cls ();
 message ("%d %s", ((Foo) cls).m(), ((Bar) cls).m());
}

Will output 10 bar.

The new (unowned type)[] syntax allows to represent "transfer container" arrays. Whereas it's possible to do List<unowned type>, now it's also possible with Vala arrays.
Beware that doing var arr = transfer_container_array; will not correctly reference the elements. This is a bug that will eventually get fixed. It's better to always specify (unowned type)[] arr = transfer_container_array;
Note that inside the parenthesis only the unowned keyword is currently allowed.

The non-literal length in fixed-size arrays has still a bug (lost track of it) that if not fixed may end up being reverted. So we advice not to use it yet.

Thanks to our Florian for always making the documentation shine, Evan and Rico for constantly keeping the bindings up-to-date to the bleeding edge, and all other contributors.

More information and download at the Vala homepage.

2014-03-21

Planet Vala

After a discussion on the mailing list about the wish of having an rss aggregator for Vala, here it comes: http://planet.vala-project.org/
The announcement can be read here: http://www.mail-archive.com/vala-list@gnome.org/msg10337.html

Please visit the home of the Vala programming language for more information.

2014-02-06

What to expect from the wip/transform branch

You may be wondering what is it all about the wip/transform branch in the vala git lying around since a couple of years.
It introduces a new layer to the compiler in order to write transformations of Vala code into other Vala code, such that it's easier for the codegen layer to generate C code, and it's easier for us developers to write and maintain such transformations.

The current Vala pipeline is as follows:
You already got it. There are a couple of flaws in this pipeline:
  • The semantic analyzer not only checks the code, but also does transformations for simplifying the code that will reach the codegen.
  • The flow analyzer does not analyze the original code, rather the transformed code. This leads to loss of information, thus bugs that are fixable only by making the flow analyzer more intelligent or with hacks (see this bug for example)
  • At the codegen level, we do complex transformations which are hard to maintain.
The wip/transform branch introduces a pluggable visitor for transforming Vala code into other Vala code, and it sits in between the flow analyzer and the codegen:
So this is what we gain and lose with the new approach:
  • Probably this change will hit the compiler performance, but I'm planning to reduce the number of temporary variables used, thus save time at the C compilation stage. Though we always head for correctness before optimization.
  • The semantic analyzer and flow analyzer no longer have the issues explained above.
  • The C codegen has been extremely simplified, because now the ugly transformations are made simpler in the transformer.
  • The flow analyzer needs some more code in order to handle cases that were first simplified, like conditional expressions.
Also the transformer has several cool helpers that let us write transformed Vala code using strings, like a meta language, and that's very convenient.
This new architecture naturally opens for a new feature: Vala plugins. It is possible to specify directories of plugins with --plugindir . A plugin is a file starting with "valaplugin" that is dynamically loadable (a .so, .dll, or whatelse).
There is no system directory for plugins, that's intentional:
  • The feature will be experimental.
  • The API of libvala is unstable, therefore having system wide plugins would lead to even more breakage for users.
The feature is still useful on the application level. You can create your own plugins to automatically generate code that otherwise requires much boilerplate. Think for example of some rpc protocol, serialization or orm.

Demonstration
Now let's have some fun with a sample plugin for registering unit tests with the glib test framework.
This is how your code would look like now:



We want it to be like this:


So let's write our beloved glib test plugin for Vala:


What we do here is:
  • Hook on every method definition
  • Check if they have a [Test (name = ...)] attribute
  • Then find the return statement in the main() method (context.entry_point) and cache it
  • Create a dummy statement placed right before the return statement
  • Replace that dummy statement with Test.add_func(...).
Compile the plugin with:
$valasrc/compiler/valac -C $valasrc/vapi/libvala-0.24.vapi valaplugintest.vala
gcc -o valaplugintest.so -shared `pkg-config glib-2.0 gobject-2.0 --cflags --libs` -fPIC -I../vala -I../gee valaplugintest.c

Finally compile newtest.vala with:
$valadoc/compiler/valac --plugindir . test.vala

Status
The current wip/transform branch is usable and very promising. Many complex projects already build and run flawlessly.
* While in the picture I put the gtkmodule as transformer, this is not true yet. The gtkmodule is still in the codegen, but won't take much to port it as a transformer.

Hope the next wip/transform branch will be about a call for testing before the merge :-)

2014-02-04

Vala 0.23.2 released

A new development version of the Vala programming language has been released.

Changes

  • Bind GDK event structures as compact classes.
  • Switch gdk-x11-3.0 bindings to .gir.
  • Switch librsvg-2.0 bindings to .gir.
  • Bug fixes and binding updates.

    First I'd like to thank Rico for the great effort put on updating bindings.

    Then, Gdk.EventKey & co have been converted from structs to classes, and this probably broke your code, but that's for a good reason (see this bug comment).
    We're aware of this kind of breakage:
    Gdk.EventMotion *e = (Gdk.EventMotion *) (&event);

    This could be fixed as:
    Gdk.EventMotion e = (Gdk.EventMotion) event;

    For more information please visit the Vala homepage.

    2013-12-02

    Before using GTask in Vala...

    ...consider this function:



    As an exercise, extend this code to use ThreadPool.

    2013-11-19

    Vala 0.22.1 released

    A new stable version of the Vala programming language has been released.

    Changes since 0.22.0

    • GIR parser updates.
    • Bug fixes and binding updates.
    Though the summary above does not seem to be impressive, this release brings important bug fixes, refinements to the compiler and lots of language bindings updates.

    More information at the Vala homepage.

    2013-09-14

    Vala 0.21.2 released

    This new development version of the Vala programming language has been released. It includes several bindings enhancements.

    Changes

    • Recognize ref/unref functions in .gir files.
    • Add geocode-glib bindings.
    • Bug fixes and binding updates.
    Recognizing ref/unref functions in .gir files is especially useful to avoid calling g_boxed_copy/free instead of _ref/_unref directly, or to catch some compact classes that are not glibish yet reference counted.

    More information and download at the Vala homepage.

    2013-08-04

    Vala 0.21.1 released

    This is the first 0.21.x develeopment release of the Vala programming language. It includes several bug fixes and enhancements.
    The changes since Vala 0.20.1 follows:

    Changes

    • Support \uXXXX escape sequences.
    • Support specifying vfunc order in interfaces to define ABI.
    • Support GTK+ widget templates.
    • Bug fixes and binding updates.
    For a primer on how to use GTK+ widget templates, please see: http://blogs.gnome.org/tvb/2013/05/29/composite-templates-lands-in-vala/
    The above tutorial is not up-to-date but it's a good starting point.

    About specifying vfunc order, it's done with [CCode (ordering = x)] where x is the desired position of the method in the vtable. Either none or all of the virtual functions must have an ordering.

    2013-03-19

    Vala on Android

    Breaking news in the Vala programming language mailing list here.

    It has been managed by tarnyko to compile Vala sources under Android and be able to use Cairo. GTK+ has not to been ported. I'm quoting the interesting part of message verbatim below:
    I managed to compile a Vala source directly to Android binary yesterday. And I think it might be of some interest to some people here.

    For the record, I've written a tutorial here: http://www.tarnyko.net/en/?q=node/25

    It's still very limited (only access to core Vala + GLib/Gobject methods) but it could easily be extended by porting libraries having Vala bindings ; although I know it's not easy stuff.

    For the graphical part, GTK+ doesn't work yet but I know Cairo has been ported (http://code.google.com/p/cairo4android/) -and Cairo definitely has Vala bindings.

    More information at the Vala programming language homepage.

    2013-02-21

    Vala 0.19.0 released

    A new development version of the Vala programming language has been released.

    Changes

    • Support scope = "async" attribute for parameters.
    • Add --api-version option.
    • Add atspi-2 bindings.
    • Add gstreamer-rtsp-server-1.0 bindings.
    • Bug fixes and binding updates. 
    It must be noted that the new scope = "async" attribute is implemented only for bindings and not for Vala-written code. The scope = "async" is used with delegates without GDestroyNotify, and it specifies that the delegate will be called only once. So Vala will automatically take care of ref'ing the user data when passing the delegate, and unref'ing it after the delegate has been called.

    2012-10-23

    Vala 0.18.0 + GTK 3.4.2 for Win32

    This is an update of the unofficial build of the Vala programming language for Win32 kindly contributed by tarnyko. His announcement is as follows:

    I come back to announce a bundle for Vala 0.18.0 and GTK+ 3.4.2 on Windows. for Vala 0.18.0 and GTK+ 3.4.2 on Windows.
    Download link here :
    http://www.tarnyko.net/en/?q=node/13
    or here :
    http://www.tarnyko.net/dl/vala.htm
    (A helpful being told me that my formers installers had the bad habit of emptying the PATH variable if it was longer than 1023 characters: http://www.tarnyko.net/en/?q=comment/307#comment-307. It is now fixed for all installers ; please re-download them just in case.)

    News for ValaWinPKG users
    • The repos for Vala 0.16.0 and 0.18.0 are finally up !
    • There are some packages regressions:
      • FreeGLUT VAPI doesn't seem to work with Vala > 0.12.0. Needs some fixes from its original maintainer;
      • Poppler doesn't work anymore, should apparently be updated. Will do this when I have time.
      • There is a new package: LibUSB.
    • If you want to use these new repos, you should really update ValaWinPKG before (http://www.tarnyko.net/en/?q=node/12). Sorry, but it's the last time it should be necessary.
    • The new version of ValaWinPKG allows you to have multiple Vala installations and maintain their packages separately. See this tutorial (http://www.tarnyko.net/en/?q=node/14) for more info.
    Regards,
    Tarnyko

    2012-09-25

    Gee 0.8.0 released

    Together with Vala 0.18.0, the Vala collections library has also released the major 0.8.0 version, due to changes to the ABI.

    Changes

    • Fix Traversable.chop (bug #684348)
    • Remove unnecessary method
    • Update README
    • Move everything to GenericAccessor
    For more information and downloads see the Gee homepage.

    Vala 0.18.0 released

    The new stable branch of the Vala programming language has reached the 0.18.x version. There are major fixes and enhancements since the 0.16.x that are described below.

    Changes since 0.16.0

    • Add libgnome-menu-3.0, gstreamer-1.0 core, gst-plugins-base-1.0, gobject-introspection-1.0 bindings.
    • Support subclassing of GLib.Source.
    • Switch pango bindings to .gir.
    • Warn when accessing static members with an instance reference.
    • Recompute length when casting between array types. 
    • Support [GenericAccessors] attribute for interfaces.
    • Deprecate implicit .begin for async methods.
    • Drop Dova and POSIX profile.
    • Require and target GLib >= 2.18.
    • Support async creation methods.
    • Improve assertion messages.
    • Add --enable-gobject-tracing commandline option. 
    • Support simple method-level profiling.
    • Add VALA_CHECK_MODULES and VALA_PROG_VAPIGEN to vala.m4.
    • Bug fixes and binding updates.
    The [GenericAccessors] attribute allows using generics in interface methods. Before this change, it was impossible to access the generics information of a subclass from within an interface method. Adding this attribute on top of an interface will autogenerate virtual methods at the C level that are automatically implemented by subclasses. It must be noted that using this feature on an existing interface will break the ABI.

    The method-level profiling is enabled by adding the [Profile] attribute on top of your methods. When your application terminates, some stats will be printed to the output.

    For more information and download see the Vala homepage.

    2012-09-17

    Vala bundle for Windows

    Hi,
    tarnyko contributed an unofficial Vala bundle containing Vala 0.12.0 and GTK+ 3.4.2 for Windows XP/Vista/7.
    This one contains GTK+ 2.20.0, too, so you can still compile older GTK+ programs without modification.
    Download here :
    http://www.tarnyko.net/en/?q=node/1
    or here :
    http://www.tarnyko.net/dl/vala.htm

    For ValaWinPKG users,
    the corresponding repository has been uploaded. A few notes:
    • you should definitely update the program (here: http://www.tarnyko.net/dl/valawinpkg.htm) because 0.9b is broken with this bundl; 
    • newer GLib allows use to have a Clutter package 
    • newer GLib, however, gives problems with older LibGee and WebKit, so they've been removed from this new repo (should only be temporary);
    • LibMX package is planned.
    Final note:
    A Vala 0.16.0 for Win32 bundle is WIP. It already works, only needs a few tweaks before uploading.


    Original discussion here: https://mail.gnome.org/archives/vala-list/2012-September/msg00065.html

    2012-08-20

    Vala 0.17.5 has been released

    Hello, the new 0.17.5 development version of the Vala programming language has been released with lots of enhancements, bug fixes and language bindings.

    Changes

    • Support subclassing of GLib.Source.
    • Switch pango bindings to .gir.
    • Add gstreamer-1.0 core bindings.
    • Add gst-plugins-base-1.0 bindings.
    • Add gobject-introspection-1.0 bindings.
    • Bug fixes and binding updates. 
    More information and download at the Vala homepage.

    2012-08-06

    Vala 0.17.4 released

    The 0.17.4 development version of the Vala programming language has been released. Some interesting changes have been introduced, while others have been dropped toward a more cleaned up code base.

    Changes

    • Warn when accessing static members with an instance reference.
    • Recompute length when casting between array types.
    • Support [GenericAccessors] attribute for interfaces.
    • Deprecate implicit .begin for async methods.
    • Drop Dova profile.
    • Drop POSIX profile.
    • Bug fixes and binding updates. 
    The [GenericAccessors] attribute allows using generics in interface methods. Before this change, it was impossible to access the generics information of a subclass from within an interface method. Adding this attribute on top of an interface will autogenerate virtual methods at the C level that are automatically implemented by subclasses. It must be noted that using this feature on an existing interface will break the ABI.

    More information and download at the Vala homepage.

    2012-07-17

    Vala 0.17.3 released

    The new 0.17.3 version of the Vala programming language has been released. We'll include the changes of the 0.17.1 release as we haven't posted them previously. We skipped the 0.17.2 and 0.16.1 versions as they haven't enhanced any feature.

    Changes (both 0.17.3 and 0.17.1)

    • Require and target GLib >= 2.18.
    • Support async creation methods.
    • Improve assertion messages.
    • Add --enable-gobject-tracing commandline option.
    • Bug fixes and binding updates. 
    More information and downloads at the Vala homepage.

    2012-05-11

    Vala 0.17.0 released

    The new 0.17.x development cycle has started. This is the first release introducing several bug fixes and some enhancements.

    Changes

    • Support simple method-level profiling.
    • Add VALA_CHECK_MODULES and VALA_PROG_VAPIGEN to vala.m4.
    • Bug fixes and binding updates. 
    The method-level profiling is enabled by adding the [Profile] attribute on top of your methods. When your application terminates, some stats will be printed to the output.

    More information at the homepage of Vala.