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 587030 - instanceof Gtk.FileChooser not implemented
instanceof Gtk.FileChooser not implemented
Status: RESOLVED WONTFIX
Product: gjs
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2009-06-26 09:58 UTC by Tommi Komulainen
Modified: 2016-11-29 05:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Interface: add support for instanceof (6.64 KB, patch)
2012-03-03 00:20 UTC, Giovanni Campagna
none Details | Review

Description Tommi Komulainen 2009-06-26 09:58:10 UTC
const Gtk = imports.gi.Gtk;

log(42 instanceof Gtk.FileChooser);


Error: API of type INTERFACE not implemented, cannot define Gtk.FileChooser
Comment 1 Giovanni Campagna 2012-03-03 00:20:11 UTC
Almost three years later, probably one loses interest... anyway I've implemented it :)

It's not strictly necessary to have it in 3.4, but it should be pretty safe and fixes one clear annoyance.
Comment 2 Giovanni Campagna 2012-03-03 00:20:46 UTC
Created attachment 208888 [details] [review]
Interface: add support for instanceof

Rework the way interface objects are exposed, so that
obj instanceof My.Interface does the expected thing when obj is
a GObject.
Comment 3 Jasper St. Pierre (not reading bugmail) 2012-03-03 00:41:50 UTC
Review of attachment 208888 [details] [review]:

Not a fan of the implementation.
Comment 4 Giovanni Campagna 2012-03-03 00:46:42 UTC
(In reply to comment #3)
> Review of attachment 208888 [details] [review]:
> 
> Not a fan of the implementation.

Neither I am, but there doesn't seem to be a better way to implent it. The interpreter looks only at the JSClass of right hand side of instanceof, which is js_FunctionClass, unless we introduce this hack.
Comment 5 Philip Chimento 2015-06-22 20:21:41 UTC
FWIW, this would be solved by a patch on https://bugzilla.gnome.org/show_bug.cgi?id=751343 where you could do 

Gtk.FileChooserButton.implements(Gtk.FileChooser) // --> true
let button = new Gtk.FileChooserButton();
button.constructor.implements(Gtk.FileChooser) // --> true

It's unclear to me how "instanceof" will interact with ES6 classes/interfaces, so that was the rationale for not doing it with "instanceof".
Comment 6 Philip Chimento 2016-11-29 05:45:30 UTC
Going to close this one and stick with Lang.Class.implements(), since that's what we have now, and it doesn't change the expected semantics of "instanceof".