On 2/10/23 9:43 AM, Emiliano Heyns wrote:
> Would (absense of) 6/7 compatibility shims fall under the category of
> "problems in the default environment"?
It depends.
I was mainly talking about Zotero 7 — if a plugin targeting only Zotero
7 needs to use third-party code for basic functionality, that's a
problem, and we really want to avoid a situation where all plugins start
depending on a third-party API that we can't provide support for, that
may not have future core changes in mind, and that may not have the
longevity of the official project. So if something can't be done easily
in Zotero 7, we want people to let us know so we can improve the default
experience.
For Zotero 6, we haven't added any compatibility shims for Zotero 7 APIs
because a plugin developer couldn't necessarily count on a user being on
a new-enough Zotero 6 version to have the shim, whereas if they
explicitly handle both APIs or bundle a compatibility shim, they'd know
it would work. For many existing plugins, compatibility might be as
simple as leaving in existing code behind some
`Zotero.platformMajorVersion < 102` checks.
That said, the vast majority of Zotero users do upgrade immediately, and
we don't provide official support for older versions anyway, so if a
plugin developer is comfortable just showing an error if someone is on
an outdated Zotero 6 version, that seems totally reasonable to me. So if
there's general interest in our incorporating some compatibility shims
to make the transition easier, we'll happily take patches for that. (I
don't know that it makes sense for us to spend time developing such
shims at the expense of actually finishing Zotero 7.)
But a shim is a shim — it implements a newer API in an older version.
And that's not what plugin-toolkit is. XY Wong and others have created
some truly incredible plugins, but I think it would be a real mistake
for other unaffiliated developers to start filling their codebases with
third-party abstractions on top of things that there are already
perfectly standard ways of doing in Zotero (e.g., `FilePickerHelper` vs.
`new FilePicker`, or `ui.createElement` instead of native DOM methods).
I understand that it can be hard to find the best ways to do things in
200K or so lines of Zotero code, and that some things (particularly
Mozilla-isms) that we on the core team are quite used to could be made
easier for outsiders, but I think effort would be better spent improving
documentation, proposing/implementing new official APIs, perhaps adding
TypeScript definitions, etc., rather than creating unofficial
dependencies. This is something we may be able to put some resources
towards, but the first step would be feedback on the places where people
are having trouble.
- Dan