Re: GObject's property with _ issue
"Jukka Zitting" <[email protected]> Mon, 20 Feb 2006 17:26:28 +0200
| Newsgroups | gmane.comp.web.midgard.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, On 2/20/06, Torben Nehmer <[email protected]> wrote: > One question: why can we use underscores in class names, but not in properties? > Sounds strange. The problem Piotras encountered is that GLib canonicalizes the GObject property names to dash-naming-convention. This makes sense given the GTK background of GLib, but does tend to cause problems with language bindings. See for example: http://www.sicem.biz/personal/lgs/docs/gobject-python/gobject-tutorial.html#d0e482 The class names are not canonicalized by GLib. > Jukka, I didn't fully understood how you would do that name > mapping, but it at least *sounded* good for me. My idea is based on the fact that we in any case need to keep track of more information per property than what is done by GLib. The MidgardObjectProperty class could keep track of the original NCName of a property so that it can be used to map properties correctly. For example if we have a property named "some_ComplexName", then midgard-core would keep track of the following mappings: sql("some_ComplexName") => "some_ComplexName" glib("some_ComplexName") => "some-ComplexName" Midgard-PHP would keep track of the following: php("some_ComplexName") => "some_complexname" And Midgard-Java: java("some_CompexName") => "some_ComplexName" These name mappings could be automatically applied and unapplied whenever the API boundaries are crossed. Things like QB and reflection capabilities would do this translation also for all property name strings. I agree that this solution is a bit complex conceptually, but in practice it would be totally transparent to applications. BR, Jukka Zitting -- Yukatan - http://yukatan.fi/ - [email protected] Software craftsmanship, JCR consulting, and Java development