I suggest then that you open a bug report on
bugzilla.gnome.org proposing to reverse the flag. It would be a 3-line patch to change GJS_DISABLE_EXTRA_WARNINGS to GJS_ENABLE_EXTRA_WARNINGS, so I don't think doing the work will be the problem. I think your reasons make sense, so you shouldn't have trouble convincing the maintainers.
Sure. Here's a slightly contrived example of writing a GObject-derived class with GObject properties:
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
Gtk.init(null);
const TimerLabel = new Lang.Class({
Name: 'TimerLabel',
Extends: Gtk.Label,
Properties: {
'timeout': GObject.ParamSpec.uint('timeout', '', '',
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
1, 10, 1),
'count': GObject.ParamSpec.uint('count', '', '',
GObject.ParamFlags.READABLE, 0, GLib.MAXUINT32, 0),
},
_init: function (props) {
this.parent(props);
this._count = 0;
this.label = 'Hello World!';
GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, this.timeout, () => {
this._count++;
this.notify('count');
return GLib.SOURCE_CONTINUE;
});
},
get count() {
return this._count;
},
});
let win = new Gtk.Window();
let label = new TimerLabel();
win.add(label);
win.connect('destroy', Gtk.main_quit);
label.connect('notify::count', (obj) => {
if (obj.count === 10)
Gtk.main_quit();
});
win.show_all();
Gtk.main();
The Lang.Class metaclass looks for two special keys, Properties and Signals, to create GObject properties and signals internally. You could use ES2015 native properties, but AFAIU you won't get features like GObject's "notify" signal (used in the example above.)