Re: [Vala] Examples for a starter.



On Sam, 2007-03-10 at 11:09 -0300, Alexandre Moreira wrote:
I was wondering then: Does anyone have valuable examples for a starter
? I admit that some of the examples I need are not exactly
"beginner-examples" but I'll simply post a list of the examples I
think would be useful for something like a "Programming by example"
document, which could then be put on the page, and feel free to add
more ideas and post examples if you want.

I think it is a great way to increase the ammount of docs for Vala
without putting some one to actually try to write a organized doc.
Programming by example rules.

Yes, that would certainly help a lot, everyone is welcome to add
examples to the wiki at http://live.gnome.org/Vala . I want to
concentrate on finishing basic support for all major features in the
compiler before writing documentation but it'd be nice if early users
could already collect some documentation and examples in the wiki.

Here goes my personal list.

Interface implementation and required interfaces;

Follows GObject principles quite far:

public interface FooA {
        public abstract void interface_method_a ();
}

// FooA is prerequisite of FooB
public interface FooB : FooA {
        public abstract void interface_method_b ();
}

// Bar needs to specify prerequisite FooA explicitly, current SVN
// version checks that you don't miss anything
public class Bar : FooA, FooB {
        public void interface_method_a () {...}
        public void interface_method_b () {...}
}


Calling C Code (and of a non-GObject based library) from Vala programs;

The included VAPI files should serve quite well as examples. You should
ask on the list for concrete problems in writing VAPI files.


Complex signal hooking (I don't know if vala does this but I'd like to
know how it treats -- if it does at all -- connect versus
connect_after) ;

Not supported yet, we're open to suggestions how the syntax should look
like for connect_after.

Jürg




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