Meeting on irc.gnome.org:#gtk-devel Meeting started May 23 2005 16:01 EDT In attendence: Matthias Clasen (mclasen), Owen Taylor (otaylor), Maciej Katafiasz (mathrick), Scott Arrington (muppetman), Johan Dahlin (jdahlin) ok, sorry for the continued timezone confusion I hope I figure this out before EDT ends so, lets quickly talk about guadec again should we announce a gtk team meeting as a "freeform session" on monday afternoon ? or does that one hour slot have too many conflicts ? mclasen: I'm not sure when would be better ok, do we announce these somewhere, guadec-list@gnome.org ? Or just put them on the wiki ? mclasen: I'd just put it onto the wiki ok, will do that tonight OK, what's our other agenda for today? well, ...we can again discuss some details of the introspection work I experimented a bit with getting struct offsets in the .xml I did a quick perl script which parses the .xml, generates C source to call G_STRUCT_OFFSET on all struct fields, then folds the results back in the .xml that seems to work fine in general, provided we add optional information about C names of structs, class structs and fields to the .xml where those are different from the name/type-name we currently have in the .xml the one problem is that G_STRUCT_OFFSET yields an error for bitfield members so its probably best to just skip them, struct offsets would be meaningless for them anyway mclasen: you still need to access them somehow a "properly bindable" api would have getters/setters for them which reminds me, do we have a way to express "this function is getter for that C struct field"? we have a way to express "this function is getter for that object property" which isn't enough when we specifically mean structs, is it? it also doesn't cover fields in objects which are not exposed as properties is this information really important, though ? hmm, yeah, but these should be regarded private, no? mclasen: if you bother to expose struct as struct, then probably yes mathrick: i think if there are getters/setters, then there is no real need to expose the field in the .idl at all I'd see struct as basic form of "improperly bindable api" compat, otherwise, it doesn't really make sense to introduce structs at all I also doubt that the connection between [sg]etters and properties is really needed. Maybe setters and getters for properties should just not be described, in the idl, since bindings can use the generic g_object_set_property there are lots of improperly bindable apis. mclasen: well, if it's not GObject, then you can't mathrick: if it is not a gobject, then it doesn't have properties (which I was talking about here) I think structures are moderately useful things to represent, but we shouldn't go overboard. IF we don't have examples of needing bitfields, trying to handle them is overkill mclasen: exactly mathrick: object properties as opposed to struct fields mathrick: In terms of field/getter/setter/property connections mathrick: that seems moderately useful, but perhaps could be left until language bindings authors make noise that they really need it is there a backlog handy? muppetman: it's very short, sec mathrick: My instinct would be to put everything in the introspection information, though. mclasen: thanks owen: yeah semi-opaque structs are all too common in real-world APIs mathrick: I think trying to second-guess and include only some things could limit some interesting uses of introspection owen: i can think of a couple of in-house APIs to which i'd like to apply the introspection info, and they use bitfields in plain structs. (E.g., using introspection to enhance a C IDE) is documentation going to be generated using introspection? muppetman: well, if you want to write the code to portably determine offsets, types, and masks for bitfields.... muppetman: Seems like something that can be added later, though jdahlin: I'd strongly opt for that owen: how would one determine bit offsets ? toggle the bit in one copy of the struct, then diff against the original ? jdahlin: I don't think we know at this point. If we can get rid of the header file parser in gtk-doc , though, that woudl be distinclty nice. mclasen: that's an idea jdahlin: Note that we aren't going to be able to *entirely* dump it, since gtk-doc is in use for non-GObject-based projects that aren't necessarily intropsectable owen: If you don't mind loosing some typename details and header comments, it should be possible to regenerate reasonable docs from whats currently in the metadata however, all the offset info is going to make idl non-portable mathrick: thus my experiment with enhancing the .idl at build time mclasen: mhm mclasen: that diff thing is good idea mclasen: I suppose you could do that. I was leaving it up to muppetman's ingenuity :-) uh, thanks, i think Knowing architecture rules would be other other way to do it. mclasen: you can do that trivially, and it's guaranteed to be portable, I think owen: best to use compiler, if that work has been already done :) owen: makes us safe against gcc-changing-abi-on-obscure-archs, too . In any case, I think bitfields are an excercise left to the reader not to mention compiler flags that can change structure-packing rules muppetman: good point owen: I think diffing structs is trivial enough to make it worthwile mathrick: if you want to play around with adding that, my perl script is in cvs as gidloffsets.pl mclasen: ok mathrick: also, did you get around to work on an annotation proposal ? mathrick: OK, but it's irrelevant to the goal of getting GTK+ bindings based on introspection up and working and getting this stuff into 2.8 mclasen: almost, but got distracted by uni work and didn't put anything comprehensible together after all so the introspection stuff is really targeted for 2.8? muppetman: that's what we are trying to do... owen: not directly, perhaps. But I'd really like to have it reasonably complete in first incarnation sweet I'd much rather have it reasonably *rught* in the first incarnation right, that is mmh, rught code haha owen: getting right includes not introducing potential incompatibility points :) So, if there are things that we aren't sure if they are right nor not and can be added later, that's an argument for adding them later i noticed in the todo something to the effect of trying a different API approach for the metadata... i have to admit, drilling down through the info structures is a little tedious owen: thats a good point. I should probably go through over the current metadata format, and figure out which of the unimplemented pieces to drop for the initial merge, after making sure we can add them later muppetman: I would be happy for alternate proposals i was thinking mostly of functions that skip a few levels of indirection... but was wondering if you had anything in mind. muppetman: do you have something like a prototype for perl? and why muppetman and not muppet? :) muppetman: I think the main alternative would be some form of iterator api hmm, GString has been removed from IDL? instead of the current get_n_xyz() get_nth_xzy() approach mathrick: i believe it doesn't need a dedicated type tag, and can just be a regular struct type (sorry, had an office pop-in.) mathrick: erm, muppetman because muppet was taken on a different server and i forgot to reset. yes, kaffee and i have been working on a perl prototype mclasen: maybe, but OTOH, it's one well-defined string type languages are using I think muppetman: cool i did some low-level stuff as a proof of concept, and kaffee got some method calls on poppler through the IDL on saturday mclasen: we still have some typecodes left, 5 bits is plenty of room ;) uh-oh, g-idle-offsets._pl_ yuck perl s/idle/idl/, even mathrick: I suck at scripting, and choosing perl allowed me to copy stuff from gtk-doc... mclasen: I believe you, but I know only enough perl to hate it, nothing more what does that do? my $struct = shift; my $name = shift; that pulls parameters off the stack the same thing shift does in shell scripts, I believe indeed my ($struct, $name) = @_; would be more idiomatic oh, from argv[]? mathrick: No, for the function. no, from @_, which is the parameter list for a sub ah I must say, *ick* why not old-school param list? ask larry wall. mathrick: perl was very shell-like in its early days. There are, of cours,e things you can do with the arg-list variable that you couldn't do with a param list. You can say, for example 'some_other_func(@_);' so all perl subs are in essence variadic? yes. owen: some_other_func($*) ? you can use prototypes (if you like adding more line noise) to override that or $@ if you prefer @_ muppetman: bleh muppetman: I mean in shell oh. yes. nice little perl workshop, but do we have anything else to discuss today ? one of the other items in the todo is to check how it scales to gtk+-size API muppetman: that will have to wait for scanner, I believe any plans for that? regarding that, I hacked a mostly complete gdk.idl last week, and ended up with ~32k of metadata mclasen: manually? O_o mathrick: I used the C# scanner plus a combination of tweak-the-output and tweak-my-parser to get it converted to metadata well, even with a scanner, you'll still have to go through everything by hand to verify and fixup details. mclasen: hmm, we have some uint16 offsets there, don't we? mathrick: where is "there" ? mclasen: in metadata mathrick: the uint16's should all be indices into the directory, all direct blob offsets should be uint32's i seem to recall that there were some in the string table... don't remember if those are relative though mclasen: ah, ok what was the largest portion of the metadata? was it the dictionary? muppetman: there is no dedicated string table anymore, strings just appear "between" the other contents ah. sorry, i'm outdated muppetman: I believe the bulk was strings, and sharing them did not help a lot (and apparently quite bad with the keyboard today) $! is what, last error message? in that case, i suppose docstrings would be out of the question. mathrick: Yes, more or less mathrick: very accurate guess. May 23 17:01:34 * owen will skip the "interesting" nature of $! here docstrings need to be there annotation, annotation i'd love them to be there; automatic generation of manpages... but wouldn't that make the metadata huge? mclasen: hmm, right May 23 17:02:42 * mclasen doesn't look forward to read those man pages, unless you embed complete man pages in the metadata... mclasen: yeah mclasen: more or less muppetman: somewhat muppetman: but we do that today with pygtk, and live with it I guess one could think about adding something like pngs ztxt to the metadata ztxt is compressed text? yes yes, perhaps that would make sense that sounds like something for which to leave a placeholder in v1.0 muppetman: if we have basic annotation support, I think we don't need further placeholders my %Sizes; is array? annotations are typed? we could annotate the annotations to indicate they're compressed ! muppetman: will be when I finish the proposal mclasen: :) mathrick: hashtable, associative array. mclasen: nah, just builtin type mclasen: hmm May 23 17:08:57 * muppetman wracks brain to remember feedback he wanted to provide mclasen: either we create magic bulting CompressedDocstringAttribute type, or add zstring as SimpleType? muppetman: my wife just called to pick me up, so wrack quickly (5 more minutes...) ) is "read SIZES line-by-line, and store them somewhere"? loops over the input stream by lines mclasen: where do you live? mathrick: Acton, MA ah and where is current line stored? $_ mclasen: the current API leads to tons and tons of malloc()s while drilling through the data structures mathrick: because $_ is an implicit parameter for many common functions and operators muppetman: thats one of the arguments for going to some form of iterat or api . is concatenation operator like in PHP? mclasen: i figured. i tried to think of a way to pull it off without so many mallocs... either convenience functions that skip a layer, or returning readonly memory mclasen: but returning readonly memory leaves no room for future changes, and the convenience functions only help so much. mclasen: implicit (or not) assumption that metadata is immutable bothers me some sorry i don't have a patch, i was happy just to have time to play with this stuff. mclasen: it will make generating them from inside python not very feasible without lots of hackery muppetman: we can use GMemPool or whatever it's called well, my first prototype leaked like an open-bottom bucket till i realized i had to free those things. :-) heh muppetman: using a mem pool could in fact help for the info structs we spent some time working with how to get namespace mapping to work, and kaffee sent me his latest incarnation yesterday morning, right before i spent all day outside with the kids mathrick: I think as long as you only append and keep references intact all the time, modifying blobs at runtime should almost work I think I'll wait a little bit before working on the python bindings mclasen: not string-pooling makes sense in this case, wise move :) as i recall, we have object instantiation, method invocation, and gerror working in the prototype it's very primitive and suffering sweeping rewrites, so it's not ready for public cvs yet muppetman: being primitive and in danger of sweeping rewrites hasn't saved gobject-introspection from cvs... :-) anyway, I have to go now. How to see some of you next week in Stuttgart mclasen: later then later <-> iterator/indexing API mapping? not a lot. it's not really at the toplevel that i found it clunky; eh? < n_infos ; i++) info = get_nth_info() last sentence didn't really parse for (i = get_first_info() ; i != NULL ; i = get_next_info(i)) ... not a lot of difference. i didn't find it clunky at the toplevel. it's mostly in the deeper structures, drilling down to the info you want, that it gets a little tedious. I guess I'm naughty boy, I always omit explicit != NULL checks... muppetman: ah, that was continuation of earlier metadata API rethinking then? yes. OH, i see, you meant the language binding level iterator yes May 23 17:27:35 * muppetman is very thick today nah, it's okay, it was easy to confuse May 23 17:27:56 * mathrick wasn't overly clear either as far as TreeModel.... we currently have a pure-perl module that uses a tie to make a ListStore act like a perl list-of-lists. what is "tie" here? the tie callbacks just use the treemodel api. mathrick: "tie" is just "implement a data structure like an array using an object" e.g. associative array => DBM file ah, that is, subscriptable? yes mathrick: yeah. The set of functions you implement depends on what sort of data structure you are tying to (man "perltie" if you want to see lots of details) no, thanks :) I get the idea muppetman: I was thinking more about automatic figuring that out well, seeing what we do to implement that, i'm not sure i want to try to engineer something generic enough to do it in all cases. muppetman: ie, what sort of info would have to be in metadata to make it possible for bindings to autogenerate tie or whatever it is called in given language "most cases" would be enough mmmm you basically have to be able to answer three questions: "what's the first element", "what's the next element", and "nd "was that the last element?", with ancillary things like "nth" for good measure <-> treeiter equivalence making it work for gtk trees means it will work with almost anything else :) if tobject was marked as an iterator, then certain mehtods marked as "fetches first", etc but aren't there more iteratable structures in gtk+? I mean, tree api is the worst one after we have it working, nothing else can scare us heh the liststore is a list of row. should those rows also be iterable? no but they are subscriptable or maybe they are iterable? can you send me some code that illustrates how you want it to work? maybe we can work backwards. for now, i have to get on the road. muppetman: well, pygtk API :) muppetman: ok, see ya Meeting ended May 23, 17:46 EDT