The Caffeinated Penguin

musings of a crackpot hacker

Codey things

Posted By on February 23, 2009


Building desktop apps with JavaScript and GTK bindings.

Neat idea, but JS? Eww. Stab me in the eye, why don't you.

Vala – C#-ish syntax which compiles down to native code for the GTK+ widget set. (Article).

You lose the cross-platform-ness of .NET, but get the performance and
maturity of the GTK+ widget set.

It's kind of hawt.

Of course, if we can do this, why can't we write firmware in C# and
compile it down to raw C?

Oh, wait, we sortof can – look at D. I haven't poked it, but it looks to take a lot of the best bits of “modern” languages with the benefits of a traditionally compiled language.

Look at it like this – why are modern languages like C# and Java (and to a lesser extent, languages like PHP and Perl) good?
- Many libraries
- Modern OO features
- Write once, run anywhere*
- Automatic garbage collection (when it works)

And why are they bad?
- Slow
- Heavyweight

  • = Theoretically, but not really. Think about it – without installing the Sun JRE, you basically can't run Java. Sure, there are other JREs, but I've found them all to often not work. Since Sun's JRE isn't included by default on Mac, most Linux, and Windows, it puts the onus on the user to install it.

Similarly, if you want to do C#, you have to install Mono (though maybe it comes with your distro) and unless the app has specifically been tested to work with it, it also likely won't work because it will throw an exception at some point.

This isn't to say that it's not gettingbetter, but we've been waiting for it to get good for years now.

Meanwhile, native-compiled code puts the onus on the developers to get it to build for all different platforms, and if you statically compile it, it will basically run forever, at least until the really basic system APIs change and it needs a recompile. Plus this is an issue has been solved – on most operating systems, you install (or it comes with) a repository and package management system and just yum, apt-get or fink install the natively compiled package which you want. (Windows folks are still stuck in the 1990's, and would have to manually download and install an app, but that works too).

Also, they generally have advantages of:
- speed
- flexibility
- the ability to talk to real hardware (which is still a problem with a lot of VM-based languages – you often end up having to include a library (written in C) in order to have something which can handle things like pointers so it can write data into registers).

So, yeah, I'll have to play with D… in theory, I might even be able to cross compile and write firmware in it.. Have I mentioned that Gumstix and Arduino are equally hawt.


Comments

Leave a Reply

Please note: Comment moderation is currently enabled so there will be a delay between when you post your comment and when it shows up. Patience is a virtue; there is no need to re-submit your comment.

Spam protection by WP Captcha-Free