Commit Graph

1 Commits

Author SHA1 Message Date
Hood Chatham 861a758c3b
Add new `pyodide.ffi` JavaScript submodule with PyProxy subtypes (#3523)
This creates a new `pyodide.ffi` submodule and adds a bunch of new subclasses of
`PyProxy` to it.

There are three stages in which we are concerned with the behavior of the
objects we define:
1. at time of static typechecks
2. at execution time
3. when generating docs

Prior to this PR, the subtypes of PyProxy only work well for static type checks,
they work acceptably at runtime (just don't let the user access them), and the
docs don't look that great. This PR is primarily intended to improve the docs
for PyProxy, but they also make execution time checks work better: you can now
say `obj instanceof pyodide.ffi.PyCallable` instead of `obj.isCallable()` which
I is easier to understand and to cross reference against the documentation. I am
marking `isCallable` as deprecated.

I also made a bunch of edits and improvements to the docs.

I have deprecated `PyProxyCallable` in favor of `pyodide.ffi.PyCallable` and
`PyProxy.isCallable` in favor of `obj instanceof pyodide.ffi.PyCallable`.
`PyBuffer` has been renamed to `pyodide.ffi.PyBufferView` and a new `PyBuffer`
has been created which is a subtype of `PyProxy`.
2023-02-05 19:35:08 -08:00