Vala programming language for RISC OS

From RISC OS

Viewed 3152 times, With a total of 0 Posts
Jump to: navigation, search


Threads 4
Posts 6

This is a work in progress

I have been using the C programming language for a long time under RISC OS. For some time now we are using C# at work and although I am no fan of Microsoft, I very much like this language. Going back to C feels like going back to the stone age.

Then a colleague made me aware of Vala. Vala is a programming language that looks a lot like C# but making code usable for Microsoft platforms, it creates C code. This meant an opportunity for me: Suddenly it was possible to bring a much more modern language to RISC OS, possibly without too much hassle.

And indeed, using the excellent tools of the GCCSDK Autobuilder it was relatively easy to get the Vala compiler working under RISC OS. The compiler has been committed to the riscos.info repository for some time now.

However, to be somewhat usable, you should be able to call the OS. Although the Vala language compiles to C, this does not mean that you can embed some C stuff to call an existing library. However, there is a way to use existing C libraries from within the Vala language. This is done by Vala bindings, consisting of so-called .vapi files. These are files that describe the C library's API with a pseudo-Vala language.

As I am familiar with the OSLib and this seems a very complete interface to the OS, it seemed a good idea to make Vala bindings to this library. When I looked into this I realised that this was actually a very good choice, as OSLib describes the RISC OS API with .swi files which are used to generate the C code (and some other stuff, like assembler headers, stronghelp files and so on) using a tool called "defmod". So it should be possible to generate Vala bindings using the exact same process.

So I have been working a lot on modifying the defmod tool to generate, apart from the usual OSLib stuff, also Vala bindings. It seems I have gotten quite far with that already and some simple testprograms using OSLib are working fine.

The work is not quite ready, there are some things that still need to be done. The list isn't long anymore, though:

- Package the OSLib part.
- More testing to find shortcomings in the Vala bindings.

At this moment it is necessary to use a gcc compiler build from the repository because that has a workaround for a problem C programs generated by Vala have. It is actually a bug in Vala but I'm happy there is this workaround!

When this is done to my satisfaction, I will be ready for a release. And then we'll have a new programming language for RISC OS, one which supports lots of goodies like object orientation, interfaces, generics, not much need for pointers, the programmer does not need to think too much about memory handling, delegates. And I'm hoping some LINQ-like stuff will be possible in a future version of Vala as well.

Programs that are written in the Vala language get dependent on GLib2, which is a huge library. As this library is quite large, it unfortunately means that programs written in Vala get quite big (2000Kb-ish for a simple hello world). However, when using shared libraries this should not be a very big issue as multiple programs can use the same library, thereby having it only once in memory.

There are developments within the Vala community to remove this dependency on GLib. Maybe this would help but I have no idea when this will be released.

I hope I have generated some interest in the Vala language. Don't hesitate to contact me if you have any questions.

More on Vala: http://live.gnome.org/Vala and http://en.wikipedia.org/wiki/Vala_(programming_language)

Cheers,
Jan-Jaap










AWC's: 2.4.1 MediaWiki - Stand Alone Forum Extension
Views
Personal tools
Toolbox