Re: [Vala] Vala Coding Style



Maria Rodriguez píše v Út 23. 02. 2010 v 15:44 -0600:
Hi, 

I was looking for some advices of vala coding style. Specifically on the
following issues

*Indentation (reading preview posts, it is still not clear for me, if it
is 8 or 4 spaces)


In Vala itself tabs are used for indentation, spaces just for alignment.

*Constants or fixed values: 

for example, what is the best way to implement something like this:
where "20" value is wired, and the interface name,too?


Depends on a personal taste, I guess. But you should use
"objects.length" instead of fixed value in the for cycle.

************************************
[DBus (name = "com.hello.org")]

     public class Factor:GLib.Object
     {
       private MyObject[] objects;

       public Factory ()
       {
         objects = new MyObject[20];
         for (int ids = 0; ids < 20; ids++)
         {
           objects[ids] = null;
         }
       }
****************************************

By the way where can i found documentation about this sintaxis used when
defining an interface in dbus.[DBus (name = "com.hello.org")]


Vala's source code perhaps? :)
Joking, I don't use DBus (yet) so I have no idea.

Could I adopt Gstreamer Coding Style?, and gst-indentation tool, or does
vala already have this?


You are free to use whatever coding style you desire. Vala itself does
not restrict anything, or provide any tools for that. I guess Vala's
coding style is quite widely used, but that doesn't mean you can't use
some other style if you find it more convenient.

Any good advice on this issues, will be very useful

Regards,
Maria


Attachment: signature.asc
Description: Toto je digitálně podepsaná část zprávy



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