3 Replies - 8564 Views - Last Post: 26 August 2010 - 08:57 PM

#1 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10649
  • View blog
  • Posts: 39,548
  • Joined: 27-December 08

Week #28- Vala

Post icon  Posted 12 August 2010 - 07:01 PM

This challenge on Vala was created by athlon32 and .

Explore Vala!

Posted Image

CHALLENGE:
Try out Vala by making a simple app of any kind.

INTRODUCE THE LANGUAGE/TECHNOLOGY: Vala is a relatively new programming language (currently 0.7.9) that is designed as a wrapper for C and GLib/other GNOME Technology . It has support for OOP, generic programming, and assisted memory management. They language is very easy to read and write, and even 'noobs' could be writing programs in no time at all. Vala is also unique in the fact that is borrows much of it's syntax from both C#/Java as well as C++. This gives the language the ability to make developing easier/faster, without giving up any power.

IDEAS:
  • Port pre-existing code

  • Write an algorithm

  • Test out it's many library bindings such as Gtk+ and OpenGL

RESOURCES:
The mother-load of information is on the Official Vala website:
http://live.gnome.org/Vala

Tutorials for both noobs and experienced:
Link to compiler/good IDE downloads:
http://code.google.c.../downloads/list


HOW TO GET STARTED:
I'm currently working on a tutorial for the Vala language that I plan to submit here on D.I.C. later on. Here is the first lesson (greatly shortened). It explains setting up Vala, and compiling a Hello World program.

Setting Up The Development Envionrment

Setting Up The Vala Compiler
If you already have valac installed, you can skip this section :)

The first step to setting up valac is to download it. Here is the direct link for the most current version (at the time of this writing) for Windows:
http://valide.google.../vala-0.7.8.exe

If you are using a different OS, or would like to see what else is available, you can look here (there might even be a newer one :P): http://code.google.c.../downloads/list

*Five Minutes Later....*
Ok, now that you got it on your hard drive, we're ready to install. Go ahead and run the .EXE. The process for Windows 7 (and most other versions of Windows I assume) is as such:
- Select Language
- Next to start
- The license, accept it
- It will ask you what you want to install. Select what you want and continue.
- Choose the destination folder and click install
- You're done :D

To make sure is really worked, open a terminal and type 'valac'. As long as it doesn't say that the command wasn't found, you're good to go.

Compiling Vala
Now my conscious won't let me go any farther without a hello world example (Don't ask why :ph34r: ). Let's begin with this:
using GLib; // not required

public class HelloObject : GLib.Object {
           
    public static int main(string[] args) {
        
        stdout.printf("Hello World!");            
        return 0;
    
    }
}


OK, valac compiles '.vala' files, so you'll need to paste this snippet and then save it as nameOfFile.vala. Compiling it is pretty straight forward. Open a terminal and run the following commands:

$ cd directory_were_vala_files_is
$ valac nameOfFile.vala

If there were errors, you'll need to fix them and recompile. Pretty easy huh? (I know I'm cool ^^). It should have made a .EXE in the directory your in, you can run it by typing

$ nameOfFile.exe

Is This A Good Question/Topic? 0
  • +

Replies To: Week #28- Vala

#2 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Week #28- Vala

Posted 12 August 2010 - 08:37 PM

Just noting that the newest version is 0.9.5 http://live.gnome.org/Vala/Release
Was This Post Helpful? 0
  • +
  • -

#3 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Re: Week #28- Vala

Posted 13 August 2010 - 09:52 AM

Woohoo! Vala is cool. :)
Was This Post Helpful? 0
  • +
  • -

#4 Splatocaster  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 51
  • View blog
  • Posts: 182
  • Joined: 22-December 09

Re: Week #28- Vala

Posted 26 August 2010 - 08:57 PM

Quote

using GLib; // not required

public class HelloObject : GLib.Object {
           
    public static int main(string[] args) {
        
        stdout.printf("Hello World!");            
        return 0;
    
    }
}


Looks like a straight mix between C# and C
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1