Deprecate platform-specific GLib and Gio APIs
As of GLib 2.80, there will be platform-specific GLibUnix, GLibWin32, GioUnix, and GioWin32 typelibs. The platform-specific symbols will continue to exist in the GLib and Gio typelibs as well for the time being, but maybe not forever. We should start getting people to switch over.
One way to do this would be to add overrides to Gio and GLib for each of these functions. Example:
if (/* imports.gi.GLibUnix is available */) {
GLib.unix_open_pipe = function(...args) {
warnDeprecatedOnce('Use GLibUnix.open_pipe() instead');
return imports.gi.GLibUnix.open_pipe(...args);
};
}
(Note: warnDeprecatedOnce
would also need to be written)
The trick is how to determine if imports.gi.GLibUnix
is available. This will likely not work:
let GLibUnix;
try {
({GLibUnix} = imports.gi);
} catch {}
because the GLibUnix typelib will load the GLib typelib, which will then execute the GLib overrides file... leading to a circular dependency.
One way to handle it might be to check GLib.MAJOR_VERSION
and GLib.MINOR_VERSION
instead.