Thomas Martitz:
> Client code churn is prevented by the compatibility header.
You have deprecated the current interface, thus requiring clients to update. It is better to retain the current interface allowing clients to ignore this change.
> Is that still not acceptable?
Not without stronger justification.
Best regards
Thomas Martitz:
> In my understanding: the current interface is still working and supported with my patch, clients need _not_ to update now and can ignore the change for a while now. Perhaps you have missed it but that's because the compatibility header is implicitly included by ScintillaWidget.h. Clients need to update only once that implicit inclusion is removed, I don't care if/when that's going to happen.
You have changed the canonical names of several features then covered that up with a compatibility header. Clients are expected to use the new names and will eventually break if they don’t. Therefore there is a burden on clients to change names at some point. That burden should be avoided/minimised if at all possible.
A different approach would be to retain all the current names as canonical and introduce g-ir-scanner friendly names in a new header that is maintained for use with introspection. Clients may choose either header depending on whether they care about introspection. Nothing would be deprecated.
> The major issue with the current interface is that the type is registered as "Scintilla" and the methods begin with scintilla_ while the actual structure is called ScintillaObject. g-ir-scanner expects to find a registered type ScintillaXXX and scintilla_xxx_ (first and foremost scintilla_xxx_get_type()). Another problem is that the class structure is called ScintillaClass and not ScintillaXXXClass.
Why wasn’t this information in the original post? Patch dumps are not fun for maintainers. Not including the reasons for changes makes them difficult to review.
g-ir-scanner seems to allow omitting namespaces with —accept-unprefixed.
As I said in an earlier mail, “What is the absolute minimum set of changes that allow use of g-ir-scanner?"
Since the patch only registers (g_type_register_static) "ScintillaObject" and not "Scintilla" won't it break any applications that are calling something like g_type_from_name("Scintilla")?
Yes, I think it would.
Matthew Brush:
> It's a bit different for Vala, instead when you write a class, like say:
>
> class MyScintilla : Scintilla.Object {
> // ...
> }
>
> It generates GObject C code that gets compiled like normal C code, and it will output something like this for the structures:
>
> struct _MyScintilla {
> ScintillaObject parent;
> }
>
> struct _MyScintillaClass {
> ScintillaObjectClass parent;
> }
ScintillaClass is a typedef of _ScintillaClass (which is not defined by the naming convention) so can’t the convention-following name be added with
typedef struct _ScintillaClass ScintillaObjectClass;
scintilla_init and scintilla_class_init are static so there is no need to change them to scintilla_object_init and scintilla_object_class_init.
Since the patch only registers (g_type_register_static) “ScintillaObject” and not “Scintilla” won’t it break any applications that are calling something like g_type_from_name("Scintilla")?
> The compatiblity header is still required as an extra file because g-ir-scanner otherwise chokes on the extra symbols.
Isn’t there an #if it understands?
I suppose adding an second name for the type like this would lead to failures.
g_type_register_static(GTK_TYPE_CONTAINER, “Scintilla”, …g_type_register_static(GTK_TYPE_CONTAINER, “ScintillaObject”, …
While asking on the mailing list won’t find everyone, its best to try:Is anyone accessing the Scintilla type by string name “Scintilla” on GTK+?
Ok, but since it's static client code is not affected and therefore it's a good opportunity to adapt gobject naming style.
Yes I think so. At least such breakage would be immediately obvious by an application crash if clients do not update their code (once they use the NULL return value). But as noted at the end of the mail I don't think anyone is calling g_type_from_name("Scintilla”).
There is not a predefined macro, but as Matthew said you can have g-ir-scanner define one (and consequently skip sections).
IMO a separate file would be cleaner because we don't have to make up a define that all clients have to follow. Is there a specific reason to avoid the extra header (it doesn't affect client code)?
I suppose adding an second name for the type like this would lead to failures.g_type_register_static(GTK_TYPE_CONTAINER, “Scintilla”, …g_type_register_static(GTK_TYPE_CONTAINER, “ScintillaObject”, …
I never tried, but in the best case you'll get to two distinct GTypes which are not compatible for glib, so it's not an option.
Seems unlikely given how scintilla is distributed: clients have immediate access to all gtype-related macros and scintilla_get_type(). In fact I haven't seen g_type_from_name() in any real code even outside scintilla.
Do you want another patch round or could we convince you? :)
kugel:Ok, but since it's static client code is not affected and therefore it's a good opportunity to adapt gobject naming style.I want to review a *minimal* patch. Bugs hide in unreviewed code and the more lines of change the less each is examined.
Yes I think so. At least such breakage would be immediately obvious by an application crash if clients do not update their code (once they use the NULL return value). But as noted at the end of the mail I don't think anyone is calling g_type_from_name("Scintilla”).Its very dangerous to assume anything about how client code is using legitimate calls. Crashing applications leads to unhappiness.
There is not a predefined macro, but as Matthew said you can have g-ir-scanner define one (and consequently skip sections).How? For that matter, what command are you using to invoke g-ir-scanner?
IMO a separate file would be cleaner because we don't have to make up a define that all clients have to follow. Is there a specific reason to avoid the extra header (it doesn't affect client code)?Avoiding additional files avoids complexity and various forms of failure. Should make dependencies be updated for this change? Never multiply entities without need.
I suppose adding an second name for the type like this would lead to failures.g_type_register_static(GTK_TYPE_CONTAINER, “Scintilla”, …g_type_register_static(GTK_TYPE_CONTAINER, “ScintillaObject”, …
I never tried, but in the best case you'll get to two distinct GTypes which are not compatible for glib, so it's not an option.Why isn’t it an option? It looks to me like exporting two distinct types would support all current users as well as users of introspection.
Seems unlikely given how scintilla is distributed: clients have immediate access to all gtype-related macros and scintilla_get_type(). In fact I haven't seen g_type_from_name() in any real code even outside scintilla.I’d expect it to be used when applications want to be able to instantiate widgets that aren’t known at compile time. Perhaps in form builders or testing applications. Ohloh showed 56 million hits for “g_type_from_name” and while I’m sure lots of those are checking before registration, some are interesting.Do you want another patch round or could we convince you? :)I want to see a minimal change set that I can easily review. It took too much work to uncover the fact that the current changes are incompatible with client code that looks up Scintilla by name. It would have been even better if the original submission had included this information.
g-ir-scanner --program ./girhelperscintilla -DGTK -Duptr_t=gulong -Dsptr_t=glong $(pkg-config --cflags gtk+-2.0) -Iscintilla/include --cflags-begin -include gtk/gtk.h --cflags-end -n Scintilla -i Gtk-2.0 -i GObject-2.0 --warn-all scintilla/inlcude/ScintillaWidget.h -o Scintilla.gir
girhelperscintilla is a helper program which statically links scintilla and exports (via --export-dynamic) the scintilla_object_* symbols for gobject-introspection.
What does the make dependency have to do with this?
Here's a new patch that should be really minimal in terms of diff-size that realizes my goal. However I don't believe it's the best from a technical viewpoint (i.e. it doesn't have the extra header, I still would prefer ScintillaWidget as the new name).
kugel:I don’t think I used the term “invasive”. That would be a bit too territorial.
> On that opporunity I would like to ask to include the changes I proposed in https://groups.google.com/d/topic/scintilla-interest/Z7lk3SkBkxs/discussion which you deemed too invasive.
> Please tell me if you'll consider these then I'll pick up that effort again and rebase to the current development head.I tried to push this forward with the scigirmin.patch which was my attempt to simplify the header by removing any changes from the change set that didn’t appear necessary. The goal here is to enable Scintilla for g-ir-scanner in the simplest way possible, not to change the names of things or to add files.
Neil
I'll check again if scigirmin.patch + my changes to ScintillaGTK.cxx are sufficient (scigirmin.patch alone is not sufficient as it doesn't provide the scintilla_object_* methods and does not rename the registered type to match the class name).
scigirmin.patch+my changes to ScintillaGTK.cxx work mostly. I did have to make a small modification, so that g-ir-scanner does not see the old declarations (moved those withion #ifndef G_IR_SCANNING). I uploaded a new patch version to reflect that (patch is complete including ScintillaGTK.cxx changes).
It is possible to create a .gir file without the changes. Use the namespace ‘Scintilla’ on the g-ir-scanner command line and the attached Scintilla.gir is produced. Its not following the ModuleType convention but it still looks OK and builds into a typelib if a version number is added to the namespace.
kugel:
> in your Scintilla.gir you'll find that ScintillaObject isn't recognized as GObject class, it's a simple struct. This has some unwanted consquences
Attached is a .gir file made after the changes. There is no indication in this .gir that ScintillaObject is a GObject class. It is very similar to the .gir made from the original files but missing the three symbols that weren’t translated (scintilla_set_id, scintilla_release_resources, SCINTILLA_NOTIFY)
> a) all the gobject goodies (including automatic reference counting) don't work.
Where are you finding this out from? Do you have some form of bindings that can be published?
> c) from a) and b) follows => ScintillaObject isn't recognized as a GtkWidget/GtkContainer derivate so calling GtkWidget/GtkContainer methods doesn't work, nor you can pass it to a GtkContainer (might work with languages that use the pointers directly but not with e.g. Python)
Can you show this?
Do you have a .gir file that is different to the attached one?
kugel:
A problem with the change to ScintillaWidget.h is that it converts sptr_t to long and uptr_t to unsigned long. This will fail on 64-bit Windows where long is 32-bits. If glib types can be used then gintptr and guintptr may be better although that will impose a minimum GTK+ version of 2.18.
kugel:
> Using these should be fine.
Did you try gintptr? Did it work?
> Will you incorporate this patch now?
Not yet.
Err, I messed up with hg export. Use these patches instead.
<1-5776-Enable_g_ir_scanner_to_run_on_ScintillaWidget_h.patch><2-5777-Add_a_test_suite_to_check_gobject_introspection_data.patch><3-5778-Fix_issues_raised_by_review_and_some_more.patch>
kugel:Err, I messed up with hg export. Use these patches instead.<1-5776-Enable_g_ir_scanner_to_run_on_ScintillaWidget_h.patch><2-5777-Add_a_test_suite_to_check_gobject_introspection_data.patch><3-5778-Fix_issues_raised_by_review_and_some_more.patch>OK, committed as:
The use of the …good exemplar is still fragile with the obviousmake && make testfailing as that defaults to GTK+ 2.x and the …good file is for GTK+ 3 (first ‘include’ tag). The makefile shouldn’t stop after that problem as the file may change over time as Scintilla, GTK+, and Introspection change. Whether the script can run is interesting by itself.
Some more changes to a typo, blank lines, a comment, and change log here: