Revision [129]

This is an old revision of GenieProgramming made by Droope on 2009-08-01 07:13:52.

 

Vala and Genie Programming


What are Vala and Genie?

Vala and Genie are new programming languages, really new. Vala came first, in mid-2006, with a C#-like syntax, followed by Genie in mid-2008 with a Python-Boo-like syntax. These languages use the same compiler and support all the same features, so take your pick.
http://puppylinux.com/genie/

Forum thread:
http://www.murga-linux.com/puppy/viewtopic.php?t=39560
Vala

GNOME itself is written in C, but many of the higher-level libraries that make up the GNOME platform (such as GTK+ and Pango) make heavy use of the GLib and GObject frameworks, which implement a complete object system including types, messaging, classes, and all of the other components that make up a typical object oriented application program interface (API). GObject makes it possible to write object oriented GNOME applications in C, and also makes it simple to provide wrappers to GNOME for object oriented languages like C++ or Python.

While GObject makes object-oriented programming in C possible, it remains somewhat cumbersome. The GObject wrappers for other languages can be even worse, introducing yet another layer of dependencies which can include virtual machines of their own. Vala was created in an attempt to address these problems and make GNOME programming easier. Vala provides a C#-like syntax that integrates GObject features, but the valac compiler compiles to C output rather than assembly. The resulting C compiles normally with gcc, plus it can be distributed as source packages fully usable on platforms that do not have Vala installed. That allows the developer to use Vala's modern language features — dynamic type system, assisted memory management, and so on — while still making source releases compatible with C applications and libraries.

In addition to GLib and GObject, the Vala project produces bindings to the major GNOME libraries: GTK+, GDK, Cairo, SDL, GStreamer, D-Bus, GIO, and many more. In addition, several external projects provide their own bindings for Vala (such as Clutter), and there are third-party efforts to create bindings for other libraries, such as OpenGL. Plugins for Vala support are available for the Eclipse, Anjuta, and MonoDevelop IDEs, as well as for the editors Emacs, Vim, and GEdit. Val(a)IDE, still in development, is a dedicated Vala IDE written in Vala itself.

The latest release of Vala is 0.7.3, which went public on May 26, 2009. It is a bugfix release for the 0.7 series, which is intended to be the last development series before 1.0. The biggest change in the 0.7 series, according to developer Jürg Billeter, is to C header file generation. In previous releases, Vala would generate a .h header file for every .vala source file, which caused problems:

This caused various issues when the dependencies between the .vala source files get complex or more specifically, circular, and it did not allow us to have internal methods that can be used in multiple .vala files but remain outside the public API. Therefore we decided to move to a single public C header file with 0.7 and stop using separate header files for internal methods.

That change demanded making changes to the build system for existing Vala applications, but Billeter said it should be the last such headache for a while.

Vala 1.0 is scheduled to be released in September of 2009, coinciding with the release of GNOME 2.28. According to Billeter, the project is on track to make the 1.0 deadline, which will mark the start of a long stable release cycle during which application developers can count on language stability. The bindings to GNOME libraries are maintained separately, Billeter said, and are added to and enhanced on an as-needed basis, so they are not subject to the same schedule.

The project offers a tutorial and sample code for those new to Vala; some familiarity with GObject is expected. Benchmarks between Vala and C show no significant execution speed losses (in some cases, Vala even beats plain C).

The project maintains a list of applications developed using Vala, in whole or in part, including GNOME panel applets and full-fledged applications. The webcam utility Cheese is currently maintaining a Vala branch in addition to its main trunk, just to road test the viability of the language. Billeter noted that although people generally think of using Vala only when starting a new project, it is possible to incorporate it into an existing C code base, too. "Among our users are both, people writing C that now want to move to something higher level and also people that just start programming in the GNOME environment," he said.
http://lwn.net/Articles/334969/

How do I get started with Vala/Genie


On the past few days i have been incursionating into the world of vala. I am absolutely and completely a noob, so all I will do is tell you how to install it and give you a few links that aren't so easy to find (randomness is on my side).
Installing Vala/Genie Compiler + Val(a)ide on puppy linux.

Step one: Installing Devx.


First of all, according to MU, you need to install devx_xxx.sfs (where xxx is your version number). For example, say i were using Puppy 4.2.1, the devx module i'd have to install would be devx_421.sfs . You can find them all altoghether here:

ftp://ftp.ibiblio.org/pub/linux/distributions/puppylinux/sfs_modules-4/

Installing a sfs is easy, don't worry. All you have to do is download it, check it's checksum with the md5sum command to avoid headaches, and after (or before, please yourself) you have compared it with the checksum the ftp gives, you have to place it in /mnt/home/.

Once that step is completed, you must go to Menu > System > Bootmanager > Load SFS, and ask it to load it at boot. When you reboot, you can open a console and type "make". If it says: "make: * No targets specified and no makefile found. Stop." you have successfully completed step one.

Step 2 :Install vala.


All you have to do is to install these three pet files:

http://dotpups.de/puppy4/dotpups/Programming/Vala/vala-0.7.0-i486.pet
http://dotpups.de/puppy4/dotpups/Programming/Vala/gtksourceview-2.4.2.pe...
http://dotpups.de/puppy4/dotpups/Programming/Vala/valide-0.4-1-i686-svn-...

After that is done, you are all ready to work with vala. You can edit your files in a text editor, and save them with .gs extension for genie, and .vala extension for vala. Once the file has been saved, you can compile it with "valac file.gs" or "valac file.vala"

That will create an executable file in the current working directory.

Extra juice:


Vala tutorial with source examples: (A must check.)
http://live.gnome.org/Vala#head-9c728d151a2a0483d4f3b5837e5b545df9d8499d

Horribly complex tutorial: (sorry)
http://live.gnome.org/Vala/Tutorial

Valadoc:

http://live.gnome.org/Valadoc

http://dotpups.de/puppy4/dotpups/Programming/Vala/ Download
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki