GNOME Bugzilla – Bug 615924
don't include array length in JS API
Last modified: 2011-07-18 16:10:15 UTC
Say you've got a function like: void something (guint n_badgers, SomeEnumThusAGuint *badgers) { } where @badgers: (array length=n_badgers), then gjs requires you to pass n_badgers in your JS method call: something(2, [BADGER_1, BADGER_2]); Whereas it seems like it would be much more useful to pass: something([BADGER_1, BADGER_2]); Like you would do for a NULL-terminated array.
Yes, this was the intent. gi/function.c will need to be modified.
This will be an ABI break (though if we wanted, we could make it accept both signatures, presumably with a warning in the length-explicitly-provided case.)
(In reply to comment #2) > This will be an ABI break Do you mean an ABI break for gobject-introspection itself, or for bindings generated from it? If you mean the latter, perhaps there could be an option to opt-in to the new ABI? (telepathy-glib has never had language bindings, and we don't consider the ones Danielle is working on to be part of our API yet, so we'd rather move to a new ABI "early".)
(In reply to comment #3) > Do you mean an ABI break for gobject-introspection itself, or for bindings > generated from it? Uh, neither. This isn't about changing the gir/typelib, it's just changing *gjs*'s interpretation of it. So it would be an ABI break for gjs's wrapping of these libraries. As for "opting in", that might be more work than people care to put into it. I was just thinking more along the lines of "we need to do something so that old gnome-shell gives an (obvious) error with new gjs, and vice versa"
commit 7ed2e7d8f13376e523bea8ac1bcf4c4068472522 Author: Giovanni Campagna <gcampagna@src.gnome.org> Date: Sat May 21 19:52:25 2011 +0200 Rework how special arguments are marshalled Introduce an array of param_types for special arguments (callbacks, arrays with explicit length). This means that now more than one callback is supported for each function, and you don't need to specify an explicit length for arrays. https://bugzilla.gnome.org/show_bug.cgi?id=646632 Conflicts: test/js/testGIMarshalling.js