Xfce

Subdomains
 

Vala > C ?

  • August 5, 2007
  • Jasper Huijsmans

Brian writes about ObjC being much nicer to work with than plain old C for GUI work. I just came across an interesting project that tries to improve the situation: Vala.

It’s a new language with C#-like syntax with a compiler that generates C code. Could be interesting. Although, generally speaking, code generators suck, you shouldn’t have to deal with the generated code at all in this case. The code is written in Vala, which is compiled to native code, but if you create a library it will have (or generate?) an API that is compatible with C.

I am going to have to try this some time (because, you know, I have lots of free time to spend on playing around with obscure programming languages, oh wait, I don’t ;-) So, has anyone else tried this?

ObjC > C

  • August 3, 2007
  • Brian Tarricone

After spending 6 weeks at work learning Cocoa/OpenStep and Objective C and then writing some GUI apps, coming back to Gtk+ and C makes me kinda sad. I hate typing out really long function names. I hate the class casts required to do just about anything. I hate the boilerplate code I have to write every time I make a new GObject subclass (yes, I know about GOB, but just the presence of that code annoys me). I hate crap like G_OBJECT_CLASS(foo_object_parent_class)->finalize(obj) -- yes, I know you often have to do things like [super dealloc] in Objective C, but look how shorter that is.

I love Objective C. Is it perfect? No, of course not. Not having class variables seems a little weird (but a 'global' static variable in the implementation file will do). It's a bit slower than C (though probably only about 10% in a typical GUI app). Is the syntax a little weird? Yeah, but it's not bad. Having to type out method parameter names along with the parameters themselves can be a little annoying, but it's often more clear.

I really wish there was an up-to-date Objective C binding for GObject and Gtk+. I found GTKKit and GToolkit, but they were written for Gtk+ 1.2.

Anybody know of a more recent ObjC binding for Gtk+ that I didn't notice?

Oh, and on a side note, I also love Interface Builder. Maybe I should look at Glade sometime.