You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New API "layers" (#2, or a "C-API overhaul") should use concrete types, e.g. PyDictObject * rather than PyObject *.
Then we get type safety from the compiler, and we don't need type checking at runtime.
In the C-specific API, we'll want:
Simple upcasts (PyDictObject → PyObject) -- this is just a cast, but let's wrap it for type-safety
Fallible downcasts (PyObject → PyDictObject) -- a function that raises on bad type, and a function that
Possibly, if API functions autogenerated, we can use C++ overloads & C11 _Generic macros. That would allow taking either PyObject (and possibly raise) or the concrete type (with no overead).
The text was updated successfully, but these errors were encountered:
I'm -1 on this. I think it leads to massive API bloat and restricts our ability to innovate in the future.
I'm not saying our current system of runtime type checking is ideal, it could definitely use an overhaul, but I don't think pushing it into this layer is the right move.
New API "layers" (#2, or a "C-API overhaul") should use concrete types, e.g.
PyDictObject *
rather thanPyObject *
.Then we get type safety from the compiler, and we don't need type checking at runtime.
In the C-specific API, we'll want:
PyDictObject
→PyObject
) -- this is just a cast, but let's wrap it for type-safetyPyObject
→PyDictObject
) -- a function that raises on bad type, and a function that_Generic
macros. That would allow taking eitherPyObject
(and possibly raise) or the concrete type (with no overead).The text was updated successfully, but these errors were encountered: