Re: [Vala] Looking for some general information on Vala's capabilities



On 4/11/07, Jürg Billeter <j bitron ch> wrote:
Hi Quinn,

On Die, 2007-04-10 at 23:12 -0400, Quinn Storm wrote:
> I recently decided to convert a project I am working on from weak polymorphism
> with structs and unions to full GObject, and I'm wondering...there are
> projects like Vala out there, and I don't know for sure if they'd be for
> me...specifically, I want to easily be able to do straight C and more complex
> things in the code, as I have to do some low-level X calls (for event
> forwarding to XEmbed clients).
>
> If you are curious, gitweb can be browsed for the project at:
> http://metascape.afraid.org:13666/link/gitweb/?p=bdock
>
> I'd love to know if Vala could do what I want here, because I do like the
> straight C and gobject/gtk approach (at least better than QT/C++) but gobject
> is such a pain to write out by hand, and I would rather use the best tools
> available.

You can't use normal C code within a Vala source file but there are two
possibilities to use Vala in your project:

      * Write a Vala API file (binding) for the X libraries, so that you
        don't need to write C code at all. That's not very complicated
        usually but may be laborious if you need a large set of
        functions or structs. You can look at the files in the vapi
        folder of vala to see some examples.I'm not sure but it might be
        possible to generate VAPI files for xcb relatively easy as large
        parts of xcb are generated from protocol information files.

Just for your (actually Quinn's, since obviously Jürg is aware of it
hehe) information:

There are a couple of examples of VAPI files in Vala's source tree
(vapi directory, a bunch of .vala files).

Hope you choose that road to your project, since after one person
writes a vapi file it can be distributed among other vala programmers
and improved and then we could (now I'm having high hopes, I know)
start something like an unnofficial repository for community generated
vapi files.

I have been away from Vala programming for a while... too much work
with C# to do at my job these days... and it just gets me too tired to
look at a C# like language at home. But I'd really like to see (and
participate of) some community efforts on creating documentation and
new vapi files and sharing those, modifying and giving back,
registering them all in a wiki or list of some sort.

Let me just hope I can have more time for vala soon

Regards,
Alexandre Moreira.

      * Only write the class structure and some unproblematic code parts
        in Vala and write the rest in C. If you don't specify a method
        body in a Vala source file, it just writes the declaration in a
        C header file, so you can write the implementation in a separate
        C file.

I'd recommend the first solution if that's possible for your project as
you wouldn't have to mix Vala and C code.

Don't hesitate to post further questions and comments, I'd like to make
integration with C code as smooth as possible.

Jürg

_______________________________________________
Vala mailing list
Vala paldo org
http://www.paldo.org/mailman/listinfo/vala




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