Il giorno gio, 17/03/2011 alle 13.58 +0100, Oliver Mangold ha scritto: > On 17.03.2011 13:31, Jasper St. Pierre wrote: > > >> Me personally, I'm not in favor of writing writing it > >> in Javascript because of the dynamic typing (will be painfull to find > >> problems caused by changed Mutter bindings). > > Why do you think that? > > > Standard problem of dynamically typed languages. Checking if variables > have the right type is delayed until runtime. Example (pseudocode): > > windows = global.get_windows() > mutter_window = windows[0] > meta_window = mutter_window.get_meta_window() > meta_window.move(100,100,200,200) > > This code assumes that the object global has a method > MutterWindow[] get_windows() > that the class MutterWindow has a method > MetaWindow* get_meta_window() > and that the class MetaWindow has a method > void move(int x,int y,int w,int h) > > If you change then to a new version of gnome-shell or mutter where > anything from this interface is changed, in javascript you get an > runtime error only when a statement using it is actually executed. This > means for every update of the framework, to be reasonably sure that your > plugin still works you have to test it completely (with 100% code > coverage). This is big fun, as we are talking about GUI stuff here, so > you can't even run it automatically. That's why gnome-shell extensions have shell-version and js-version in their metadata. They won't run with a different version of the Shell, unless you explicit flag as so (after testing). Of course, this requires tracking gnome-shell development and knowing what API changes affect your code. > In Vala you get a compiler error as soon as you try to compile your > plugin. Which do you think is better? :) > > > There's no support for running various C code from an extension right > > now, either compiled through Vala or not. > > > Too bad. Another statically typed language maybe? No. The only available language is JS, since the whole extension system is implemented in JS itself. To change that, we would need to rewrite the extension system. Not to say this is impossible (we could use libpeas for example), but for now it is not planned. Giovanni
Attachment:
signature.asc
Description: This is a digitally signed message part