After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 689434 - gi: Add a nicer toString() for boxed objects too
gi: Add a nicer toString() for boxed objects too
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2012-12-01 16:46 UTC by Colin Walters
Modified: 2012-12-01 20:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gi: Add a nicer toString() for boxed objects too (9.98 KB, patch)
2012-12-01 16:46 UTC, Colin Walters
reviewed Details | Review
gi: Add a nicer toString() for boxed objects too (10.69 KB, patch)
2012-12-01 19:22 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2012-12-01 16:46:45 UTC
Previously we just printed "GLib_Boxed"; but now you see the same
thing we print for GObjects.  This is useful for all the same reasons,
but the one I wanted in particular for debugging my app was to know
the GIName/GType.
Comment 1 Colin Walters 2012-12-01 16:46:47 UTC
Created attachment 230389 [details] [review]
gi: Add a nicer toString() for boxed objects too
Comment 2 Giovanni Campagna 2012-12-01 17:34:59 UTC
Review of attachment 230389 [details] [review]:

Maybe this makes sense for more types, like unions, interfaces and paramspecs.

::: gi/boxed.c
@@ +107,3 @@
+    gjs_throw(context,
+              "This JS object wrapper isn't wrapping a GBoxed."
+              " If this is a custom subclass, are you sure you chained"

We don't support inheriting from GBoxed.
Comment 3 Colin Walters 2012-12-01 19:22:11 UTC
Created attachment 230400 [details] [review]
gi: Add a nicer toString() for boxed objects too

Use priv_from_js_with_typecheck() rather than open-coding it.  Add
unions too.

I didn't add this to GObject_Interface because honestly you never see
them - they're basically a hidden implementation detail of method
lookups.  If for example you call GLib.File.new_for_path(), which is
annotated to return the interface Gio.File, we find the underlying
GType and give you an object proxy back for that; we don't give you a
gjs GObject_Interface wrapper.

As for paramspecs - seems like a separate patch to me, since it needs
something more custom.  I never see paramspecs personally either...
Comment 4 Giovanni Campagna 2012-12-01 19:27:03 UTC
Review of attachment 230400 [details] [review]:

Looks fine
Comment 5 Colin Walters 2012-12-01 20:48:47 UTC
Attachment 230400 [details] pushed as 58cb9cd - gi: Add a nicer toString() for boxed objects too