The Paper Crane and the public static int main(string[] args)

"all languages suck"
-- some one

Why We Still use C: a case for Vala

So I have been lookingn at the Vala pagraming lanuage, and I must say I am inpressed... But why does it compile C code? Why does it not just compile straight to machine code?

The awnser is simple:

If it were to compile to machine code it would be hard, if not impossible, to reuse the librarys you make in Vala in other programs. This is the same problem that we have with CXX, CXX code is, virtualy, only reusable in CXX. While C code can, and is exposed to, vitualy, all other lanuages (Exept mabye Assembler and LISP).

An other poblem with CXX is the there is no single "true" STL, the standard does not explisetly define the functions, only interfaces, expected behaviour and expected output. Not the functions themselfs. This makes code/library reuse ard if not imposible.

In C there is one set of base librarys, only one, they have the some behaviour as all the rest of the implimentations of them. Take look at rand() function for example, is is well defined it K&R. and it looks, vitrualy, the same in all implimentations of the C Standard Library(ies).

But the again, C standard library on Windows has itoa() which is not (atleast i can not make it work) in GCC / the GNU implimentation.

This is why, when you make a library think about portability, reuse and other lanuages then your favorit. Use C (or Vala) for the love you have for your hacker brothers, sisters and undifined.

Here is a good video on C, Vala, Python and GObjects that sums up why we still use C:

Oh and BTW: I am going to write a game in Vala, and maby create a library for colliton detection for SDL_Rects.....


ehm.. peopel, if anyone has would like to have Mono runtime/jit bindings in Vala, and would like to mentor me in the magic of .vapi files and the Mono class structure, I could do some work on that...

Inga kommentarer:

Skicka en kommentar